1 /* $Id: chanlog.h 295 2005-12-16 19:44:24Z tsaviran $
2  * -------------------------------------------------------
3  * Copyright (C) 2003-2005 Tommi Saviranta <wnd@iki.fi>
4  *	(C) 2002 Lee Hardy <lee@leeh.co.uk>
5  * -------------------------------------------------------
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
16 
17 #ifndef CHANLOG_H_
18 #define CHANLOG_H_
19 
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif /* ifdef HAVE_CONFIG_H */
23 
24 #ifdef CHANLOG
25 
26 #include "channels.h"
27 #include "llist.h"
28 
29 
30 
31 #define MAX_CHANNELS 40
32 
33 
34 /* For channel logs. */
35 #define LOG_MESSAGE_C	'm'
36 #define LOG_MESSAGE	0x0001
37 #define LOG_JOIN_C	'j'
38 #define LOG_JOIN	0x0002
39 #define LOG_PART_C	'e'
40 #define LOG_PART	0x0004
41 #define LOG_QUIT_C	'q'
42 #define LOG_QUIT	0x0008
43 #define LOG_MODE_C	'c'
44 #define LOG_MODE	0x0010
45 #define LOG_NICK_C	'n'
46 #define LOG_NICK	0x0020
47 #define LOG_MISC_C	'o'
48 #define LOG_MISC	0x0040
49 #define LOG_MIAU_C	'b'
50 #define LOG_MIAU	0x0080
51 
52 #define LOG_ALL_C	'a'
53 #define LOG_ALL		(LOG_MESSAGE | LOG_JOIN | LOG_PART | \
54 				LOG_QUIT | LOG_MODE | LOG_NICK | LOG_MISC | \
55 				LOG_MIAU)
56 
57 #define LOG_ATTACHED_C	'A'
58 #define LOG_ATTACHED	0x4000
59 #define LOG_DETACHED_C	'D'
60 #define LOG_DETACHED	0x8000
61 
62 #define LOG_CONTIN_C	'C'
63 #define LOG_CONTIN	(LOG_ATTACHED | LOG_DETACHED)
64 
65 
66 
67 extern llist_list chanlog_list;
68 extern int global_logtype;
69 
70 
71 struct chanlogentry
72 {
73 	char	*channel;
74 	char	*filename;
75 	int	type;
76 };
77 
78 
79 void chanlog_add_rule(char *channel, char *file, int type);
80 void chanlog_del_rules(void);
81 
82 void chanlog_open(channel_type *channel);
83 void chanlog_close(channel_type *channel);
84 
85 void chanlog_write_entry(channel_type *chptr, char *format, ...);
86 void chanlog_write_entry_all(int type, char *format, ...);
87 
88 int chanlog_has_log(const channel_type *chan, int type);
89 
90 #endif /* ifdef CHANLOG */
91 
92 
93 
94 #endif /* ifndef CHANLOG_H_ */
95