]>
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 2 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.
24 #ifdef HAVE_ARPA_INET_H
25 #include <arpa/inet.h>
28 /***********************************************/
30 /***********************************************/
41 #define CHAN_INFO_SIZE (ci_Max + 1)
42 #define CHAN_INFO_DEFAULT "blss"
44 #define CHAN_SPAMSCAN 0x00000001
45 #define CHAN_CHANFLOODSCAN 0x00000002
46 #define CHAN_JOINFLOOD 0x00000004
47 #define CHAN_ADV_SCAN 0x00000008
48 #define CHAN_SCAN_CHANOPS 0x00000010
49 #define CHAN_SCAN_HALFOPS 0x00000020
50 #define CHAN_SCAN_VOICED 0x00000040
51 #define CHAN_SUSPENDED 0x00000080
52 #define CHAN_BADWORDSCAN 0x00000100
54 #define CHAN_FLAGS_DEFAULT (CHAN_SPAMSCAN | CHAN_CHANFLOODSCAN | CHAN_JOINFLOOD)
56 #define CHECK_SPAM(x) ((x)->flags & CHAN_SPAMSCAN)
57 #define CHECK_FLOOD(x) ((x)->flags & CHAN_CHANFLOODSCAN)
58 #define CHECK_JOINFLOOD(x) ((x)->flags & CHAN_JOINFLOOD)
59 #define CHECK_ADV(x) ((x)->flags & CHAN_ADV_SCAN)
60 #define CHECK_CHANOPS(x) ((x)->flags & CHAN_SCAN_CHANOPS)
61 #define CHECK_HALFOPS(x) ((x)->flags & CHAN_SCAN_HALFOPS)
62 #define CHECK_VOICED(x) ((x)->flags & CHAN_SCAN_VOICED)
63 #define CHECK_SUSPENDED(x) ((x)->flags & CHAN_SUSPENDED)
64 #define CHECK_BADWORDSCAN(x) ((x)->flags & CHAN_BADWORDSCAN)
68 struct chanNode
*channel
;
69 struct string_list
*exceptions
;
70 struct string_list
*badwords
;
71 unsigned int flags
: 30;
72 char info
[CHAN_INFO_SIZE
];
73 time_t suspend_expiry
;
76 /***********************************************/
78 /***********************************************/
80 #define USER_KICK 0x00000001
81 #define USER_KICKBAN 0x00000002
82 #define USER_SHORT_TBAN 0x00000004
83 #define USER_LONG_TBAN 0x00000008
84 #define USER_KILL 0x00000010
85 #define USER_GLINE 0x00000020
86 #define USER_WARNED 0x00000040
87 #define USER_KILLED 0x00000080
88 #define USER_ADV_WARNED 0x00000100
89 #define USER_BAD_WARNED 0x00000200
91 #define CHECK_KICK(x) ((x)->flags & USER_KICK)
92 #define CHECK_KICKBAN(x) ((x)->flags & USER_KICKBAN)
93 #define CHECK_SHORT_TBAN(x) ((x)->flags & USER_SHORT_TBAN)
94 #define CHECK_LONG_TBAN(x) ((x)->flags & USER_LONG_TBAN)
95 #define CHECK_KILL(x) ((x)->flags & USER_KILL)
96 #define CHECK_GLINE(x) ((x)->flags & USER_GLINE)
97 #define CHECK_WARNED(x) ((x)->flags & USER_WARNED)
98 #define CHECK_KILLED(x) ((x)->flags & USER_KILLED)
99 #define CHECK_ADV_WARNED(x) ((x)->flags & USER_ADV_WARNED)
100 #define CHECK_BAD_WARNED(x) ((x)->flags & USER_BAD_WARNED)
102 #define SPAM_WARNLEVEL 1
104 #define FLOOD_TIMEQ_FREQ 5
105 #define FLOOD_EXPIRE 5
106 #define FLOOD_WARNLEVEL 1
107 #define FLOOD_MAX_LINES 8
109 #define JOINFLOOD_TIMEQ_FREQ 225
110 #define JOINFLOOD_EXPIRE 450
111 #define JOINFLOOD_MAX 3
112 #define JOINFLOOD_B_DURATION 900
114 #define ADV_TIMEQ_FREQ 300
115 #define ADV_EXPIRE 900
116 #define ADV_WARNLEVEL 2
118 #define BAD_TIMEQ_FREQ 300
119 #define BAD_EXPIRE 900
120 #define BAD_WARNLEVEL 2
122 #define WARNLEVEL_TIMEQ_FREQ 1800
123 #define MAX_WARNLEVEL 6
125 #define KILL_TIMEQ_FREQ 450
126 #define KILL_EXPIRE 1800
127 #define KILL_WARNLEVEL 3
131 struct chanNode
*channel
;
134 struct spamNode
*prev
;
135 struct spamNode
*next
;
140 struct chanNode
*channel
;
141 struct userNode
*owner
;
144 struct floodNode
*prev
;
145 struct floodNode
*next
;
150 unsigned int warnlevel
;
156 struct userNode
*user
;
157 struct spamNode
*spam
;
158 struct floodNode
*flood
;
159 struct floodNode
*joinflood
;
160 unsigned int flags
: 30;
161 unsigned int warnlevel
;
166 /***********************************************/
168 /***********************************************/
177 void init_spamserv(const char *nick
);
178 struct chanInfo
*get_chanInfo(const char *channelname
);
179 void spamserv_channel_message(struct chanNode
*channel
, struct userNode
*user
, char *text
);
180 void spamserv_cs_suspend(struct chanNode
*channel
, time_t expiry
, int suspend
, char *reason
);
181 int spamserv_cs_move_merge(struct userNode
*user
, struct chanNode
*channel
, struct chanNode
*target
, int move
);
182 void spamserv_cs_unregister(struct userNode
*user
, struct chanNode
*channel
, enum cs_unreg type
, char *reason
);