]>
jfr.im git - irc/evilnet/x3.git/blob - src/spamserv.h
1 /* spamserv.h - anti spam service
2 * Copyright 2004 feigling
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version. Important limitations are
8 * listed in the COPYING file that accompanies this software.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, email srvx-maintainers@srvx.net.
26 #ifdef HAVE_ARPA_INET_H
27 #include <arpa/inet.h>
30 /***********************************************/
32 /***********************************************/
44 #define CHAN_INFO_SIZE (ci_Max + 1)
45 #define CHAN_INFO_DEFAULT "blssss"
47 #define CHAN_SPAMSCAN 0x00000001
48 #define CHAN_CHANFLOODSCAN 0x00000002
49 #define CHAN_JOINFLOOD 0x00000004
50 #define CHAN_ADV_SCAN 0x00000008
51 #define CHAN_SUSPENDED 0x00000010
52 #define CHAN_BADWORDSCAN 0x00000020
53 #define CHAN_CAPSSCAN 0x00000040
55 #define CHAN_FLAGS_DEFAULT (CHAN_SPAMSCAN | CHAN_CHANFLOODSCAN | CHAN_JOINFLOOD)
57 #define CHECK_SPAM(x) ((x)->flags & CHAN_SPAMSCAN)
58 #define CHECK_FLOOD(x) ((x)->flags & CHAN_CHANFLOODSCAN)
59 #define CHECK_JOINFLOOD(x) ((x)->flags & CHAN_JOINFLOOD)
60 #define CHECK_ADV(x) ((x)->flags & CHAN_ADV_SCAN)
61 #define CHECK_SUSPENDED(x) ((x)->flags & CHAN_SUSPENDED)
62 #define CHECK_BADWORDSCAN(x) ((x)->flags & CHAN_BADWORDSCAN)
63 #define CHECK_CAPSSCAN(x) ((x)->flags & CHAN_CAPSSCAN)
67 struct chanNode
*channel
;
68 struct string_list
*exceptions
;
69 struct string_list
*badwords
;
70 unsigned int exceptlevel
;
71 unsigned int exceptadvlevel
;
72 unsigned int exceptbadwordlevel
;
73 unsigned int exceptcapslevel
;
74 unsigned int exceptfloodlevel
;
75 unsigned int exceptspamlevel
;
76 unsigned int flags
: 30;
79 char info
[CHAN_INFO_SIZE
+1];
80 time_t suspend_expiry
;
83 /***********************************************/
85 /***********************************************/
87 #define USER_KICK 0x00000001
88 #define USER_KICKBAN 0x00000002
89 #define USER_SHORT_TBAN 0x00000004
90 #define USER_LONG_TBAN 0x00000008
91 #define USER_KILL 0x00000010
92 #define USER_GLINE 0x00000020
93 #define USER_WARNED 0x00000040
94 #define USER_KILLED 0x00000080
95 #define USER_ADV_WARNED 0x00000100
96 #define USER_BAD_WARNED 0x00000200
97 #define USER_CAPS_WARNED 0x00000400
99 #define CHECK_KICK(x) ((x)->flags & USER_KICK)
100 #define CHECK_KICKBAN(x) ((x)->flags & USER_KICKBAN)
101 #define CHECK_SHORT_TBAN(x) ((x)->flags & USER_SHORT_TBAN)
102 #define CHECK_LONG_TBAN(x) ((x)->flags & USER_LONG_TBAN)
103 #define CHECK_KILL(x) ((x)->flags & USER_KILL)
104 #define CHECK_GLINE(x) ((x)->flags & USER_GLINE)
105 #define CHECK_WARNED(x) ((x)->flags & USER_WARNED)
106 #define CHECK_KILLED(x) ((x)->flags & USER_KILLED)
107 #define CHECK_ADV_WARNED(x) ((x)->flags & USER_ADV_WARNED)
108 #define CHECK_BAD_WARNED(x) ((x)->flags & USER_BAD_WARNED)
109 #define CHECK_CAPS_WARNED(x) ((x)->flags & USER_CAPS_WARNED)
111 #define SPAM_WARNLEVEL 1
113 #define FLOOD_TIMEQ_FREQ 5
114 #define FLOOD_EXPIRE 5
115 #define FLOOD_WARNLEVEL 1
116 #define FLOOD_MAX_LINES 8
118 #define JOINFLOOD_TIMEQ_FREQ 225
119 #define JOINFLOOD_EXPIRE 450
120 #define JOINFLOOD_MAX 3
121 #define JOINFLOOD_B_DURATION 900
123 #define ADV_TIMEQ_FREQ 300
124 #define ADV_EXPIRE 900
125 #define ADV_WARNLEVEL 2
127 #define BAD_TIMEQ_FREQ 300
128 #define BAD_EXPIRE 900
129 #define BAD_WARNLEVEL 2
131 #define CAPS_TIMEQ_FREQ 300
132 #define CAPS_EXPIRE 900
133 #define CAPS_WARNLEVEL 2
135 #define WARNLEVEL_TIMEQ_FREQ 1800
136 #define MAX_WARNLEVEL 6
138 #define KILL_TIMEQ_FREQ 450
139 #define KILL_EXPIRE 1800
140 #define KILL_WARNLEVEL 3
144 struct chanNode
*channel
;
147 struct spamNode
*prev
;
148 struct spamNode
*next
;
153 struct chanNode
*channel
;
154 struct userNode
*owner
;
157 struct floodNode
*prev
;
158 struct floodNode
*next
;
163 unsigned int warnlevel
;
169 struct userNode
*user
;
170 struct spamNode
*spam
;
171 struct floodNode
*flood
;
172 struct floodNode
*joinflood
;
173 unsigned int flags
: 30;
174 unsigned int warnlevel
;
180 /***********************************************/
182 /***********************************************/
191 void init_spamserv(const char *nick
);
192 struct chanInfo
*get_chanInfo(const char *channelname
);
193 void spamserv_channel_message(struct chanNode
*channel
, struct userNode
*user
, char *text
);
194 void spamserv_cs_suspend(struct chanNode
*channel
, time_t expiry
, int suspend
, char *reason
);
195 int spamserv_cs_move_merge(struct userNode
*user
, struct chanNode
*channel
, struct chanNode
*target
, int move
);
196 void spamserv_cs_unregister(struct userNode
*user
, struct chanNode
*channel
, enum cs_unreg type
, char *reason
);