1
0
forked from bip/bip
bip/src/log.h

110 lines
3.4 KiB
C
Raw Normal View History

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
* 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
#define LOGLINE_MAXLEN 2048
2005-04-28 10:26:44 +02:00
struct list;
typedef struct logfile {
2005-04-28 10:26:44 +02:00
FILE *file;
char *filename;
char *canonical_filename;
2005-04-28 10:26:44 +02:00
struct tm last_log;
size_t len;
} logfile_t;
typedef struct logstore {
2005-04-28 10:26:44 +02:00
char *name;
list_t file_group;
int skip_advance;
list_t *memlog;
int memc;
int track_backlog;
list_iterator_t file_it;
long file_offset;
} logstore_t;
2005-04-28 10:26:44 +02: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;
int log_to_file;
struct bipuser *user;
2005-04-28 10:26:44 +02:00
} log_t;
log_t *log_new(struct bipuser *user, const char *network);
2005-04-28 10:26:44 +02:00
void logdata_free(log_t *logdata);
void log_join(log_t *logdata, const char *ircmask, const char *channel);
void log_part(log_t *logdata, const char *ircmask, const char *channel,
const char *message);
void log_kick(log_t *logdata, const char *ircmask, const char *channel,
const char *who, const char *message);
void log_quit(log_t *logdata, const char *ircmask, const char *channel,
const char *message);
void log_nick(log_t *logdata, const char *ircmask, const char *channel,
const char *newnick);
void log_privmsg(log_t *logdata, const char *ircmask, const char *destination,
const char *message);
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,
const char *destination, const char *message);
void log_cli_notice(log_t *logdata, const char *ircmask, const char *channel,
const char *message);
void log_write(log_t *logdata, const char *str, const char *destination);
void log_mode(log_t *logdata, const char *ircmask, const char *channel,
const char *modes, array_t *mode_args);
void log_topic(log_t *logdata, const char *ircmask, const char *channel,
const char *message);
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,
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);
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);
void log_reset_all(log_t *logdata);
2007-09-09 11:24:21 +02:00
void log_free(log_t *log);
int check_dir(char *filename, int is_fatal);
void log_reset_store(log_t *log, const char *storename);
void log_drop(log_t *log, const char *storename);
list_t *log_backlogs(log_t *log);
list_t *backlog_lines(log_t *log, const char *bl, const char *cli_nick,
int hours);
2005-04-28 10:26:44 +02:00
#endif