2005-04-28 10:26:44 +02:00
|
|
|
/*
|
|
|
|
* $Id: log.h,v 1.26 2005/04/12 19:34:35 nohar Exp $
|
|
|
|
*
|
|
|
|
* This file is part of the bip project
|
2022-01-09 20:43:26 +01:00
|
|
|
* Copyright (C) 2004 Arnaud Cornet
|
|
|
|
* Copyright (C) 2004,2022 Loïc Gomez
|
2005-04-28 10:26:44 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* See the file "COPYING" for the exact licensing terms.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LOG_H
|
|
|
|
#define LOG_H
|
2010-02-15 15:22:00 +01:00
|
|
|
#define _XOPEN_SOURCE 500
|
2005-04-28 10:26:44 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
#define MAX_PATH_LEN 1024
|
2008-11-23 15:09:24 +01:00
|
|
|
#define LOGLINE_MAXLEN 2048
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
struct list;
|
|
|
|
|
2022-03-10 13:52:03 +01:00
|
|
|
typedef struct logfile {
|
2005-04-28 10:26:44 +02:00
|
|
|
FILE *file;
|
|
|
|
char *filename;
|
2009-06-28 16:33:29 +02:00
|
|
|
char *canonical_filename;
|
2005-04-28 10:26:44 +02:00
|
|
|
struct tm last_log;
|
|
|
|
size_t len;
|
|
|
|
} logfile_t;
|
|
|
|
|
2022-03-10 13:52:03 +01:00
|
|
|
typedef struct logstore {
|
2005-04-28 10:26:44 +02:00
|
|
|
char *name;
|
|
|
|
list_t file_group;
|
|
|
|
int skip_advance;
|
2005-05-19 22:55:11 +02:00
|
|
|
|
|
|
|
list_t *memlog;
|
|
|
|
int memc;
|
2007-11-25 15:29:32 +01:00
|
|
|
int track_backlog;
|
2008-12-26 18:43:35 +01:00
|
|
|
list_iterator_t file_it;
|
2022-01-09 20:43:26 +01:00
|
|
|
long file_offset;
|
2008-12-20 14:20:50 +01:00
|
|
|
} logstore_t;
|
2005-04-28 10:26:44 +02:00
|
|
|
|
2022-03-10 13:52:03 +01:00
|
|
|
typedef struct log {
|
2005-04-28 10:26:44 +02:00
|
|
|
hash_t logfgs;
|
|
|
|
char *network;
|
|
|
|
char *buffer;
|
|
|
|
int connected;
|
|
|
|
int backlogging;
|
|
|
|
int lastfile_seeked;
|
2011-04-05 23:43:05 +02:00
|
|
|
int log_to_file;
|
2007-09-02 14:59:19 +02:00
|
|
|
|
2011-01-15 17:53:46 +01:00
|
|
|
struct bipuser *user;
|
2005-04-28 10:26:44 +02:00
|
|
|
} log_t;
|
|
|
|
|
2011-01-15 17:53:46 +01:00
|
|
|
log_t *log_new(struct bipuser *user, const char *network);
|
2005-04-28 10:26:44 +02:00
|
|
|
void logdata_free(log_t *logdata);
|
|
|
|
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_join(log_t *logdata, const char *ircmask, const char *channel);
|
|
|
|
void log_part(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_kick(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *who, const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_quit(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_nick(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *newnick);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_privmsg(log_t *logdata, const char *ircmask, const char *destination,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_notice(log_t *logdata, const char *ircmask, const char *channel,
|
|
|
|
const char *message);
|
|
|
|
void log_cli_privmsg(log_t *logdata, const char *ircmask,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *destination, const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_cli_notice(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_write(log_t *logdata, const char *str, const char *destination);
|
|
|
|
void log_mode(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *modes, array_t *mode_args);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_topic(log_t *logdata, const char *ircmask, const char *channel,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *message);
|
2008-12-15 19:19:27 +01:00
|
|
|
void log_init_topic(log_t *logdata, const char *channel, const char *message);
|
|
|
|
void log_init_topic_time(log_t *logdata, const char *channel, const char *who,
|
2022-03-10 13:52:03 +01:00
|
|
|
const char *when);
|
2005-04-28 10:26:44 +02:00
|
|
|
void log_connected(log_t *logdata);
|
|
|
|
void log_disconnected(log_t *logdata);
|
|
|
|
void log_ping_timeout(log_t *logdata);
|
|
|
|
void log_client_disconnected(log_t *logdata);
|
|
|
|
void log_client_connected(log_t *logdata);
|
2008-12-18 14:27:16 +01:00
|
|
|
int log_has_backlog(log_t *logdata, const char *destination);
|
2005-04-28 10:26:44 +02:00
|
|
|
void log_flush_all(void);
|
|
|
|
void log_client_none_connected(log_t *logdata);
|
2009-01-17 12:50:39 +01:00
|
|
|
void log_reset_all(log_t *logdata);
|
2007-09-09 11:24:21 +02:00
|
|
|
void log_free(log_t *log);
|
2008-12-18 14:27:16 +01:00
|
|
|
int check_dir(char *filename, int is_fatal);
|
2009-01-09 11:26:12 +01:00
|
|
|
void log_reset_store(log_t *log, const char *storename);
|
2009-06-25 00:43:44 +02:00
|
|
|
void log_drop(log_t *log, const char *storename);
|
2008-12-18 14:27:16 +01:00
|
|
|
|
|
|
|
list_t *log_backlogs(log_t *log);
|
2009-01-17 14:16:31 +01:00
|
|
|
list_t *backlog_lines(log_t *log, const char *bl, const char *cli_nick,
|
2022-03-10 13:52:03 +01:00
|
|
|
int hours);
|
2005-04-28 10:26:44 +02:00
|
|
|
#endif
|