]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chanserv.h
merge
[irc/quakenet/newserv.git] / chanserv / chanserv.h
1 /*
2 * chanserv.h:
3 * Top level data structures and function prototypes for the
4 * channel service module
5 */
6
7 #ifndef __CHANSERV_H
8 #define __CHANSERV_H
9
10 #include <time.h>
11 #include "../lib/sstring.h"
12 #include "../core/schedule.h"
13 #include "../lib/flags.h"
14 #include "../nick/nick.h"
15 #include "../channel/channel.h"
16 #include "../parser/parser.h"
17 #include "../localuser/localuserchannel.h"
18
19 #define CS_PARANOID
20
21 #ifdef CS_PARANOID
22 #include <assert.h>
23 #endif
24
25 /* Q9 Version */
26 #define QVERSION "0.80"
27
28 /* Mini-hash of known users on channels to make lookups faster;
29 * how big do we make it? */
30 #define REGCHANUSERHASHSIZE 5
31 #define PASSLEN 10
32 #define WELCOMELEN 250
33 #define INFOLEN 100
34 #define AUTOLIMIT_INTERVAL 60
35 #define COUNTERSYNCINTERVAL 600
36 #define LINGERTIME 300
37 #define DUMPINTERVAL 300
38 #define EMAILLEN 60
39 #define CHANTYPES 7
40
41 /* Suspension and g-line hit count limits */
42 #define MAXGLINEUSERS 50
43 #define MAXSUSPENDHIT 500
44
45 /* Maximum number of times a user may attempt to auth */
46 #define MAXAUTHATTEMPT 3
47
48 /* Maximum number of times a user may actually be authed */
49 #define MAXAUTHCOUNT 2
50
51 /* Sizes of the main hashes */
52 #define REGUSERHASHSIZE 60000
53 #define MAILDOMAINHASHSIZE 60000
54
55 /* Number of languages and messages */
56 #define MAXLANG 50
57 #define MAXMESSAGES 200
58
59 /* The list of messages */
60 #define QM_PROTECTED 0
61 #define QM_UNKNOWNCMD 1
62 #define QM_SECUREONLY 2
63 #define QM_AUTHEDONLY 3
64 #define QM_UNAUTHEDONLY 4
65 #define QM_COMMANDLIST 5
66 #define QM_ENDOFLIST 6
67 #define QM_DONE 7
68 #define QM_NOTENOUGHPARAMS 8
69 #define QM_UNKNOWNCHAN 9
70 #define QM_NOACCESSONCHAN 10
71 #define QM_CURCHANFLAGS 11
72 #define QM_CURFORCEMODES 12
73 #define QM_NOACCESS 13
74 #define QM_UNKNOWNUSER 14
75 #define QM_USERNOTAUTHED 15
76 #define QM_CHANLEVHEADER 16
77 #define QM_CHANLEVCOLSHORT 17
78 #define QM_CHANLEVCOLFULL 18
79 #define QM_NOUSERSONCHANLEV 19
80 #define QM_CHANUSERFLAGS 20
81 #define QM_CHANUSERUNKNOWN 21
82 #define QM_INVALIDCHANLEVCHANGE 22
83 #define QM_USERISAUTHEDAS 23
84 #define QM_USERISHELPER 24
85 #define QM_USERISOPER 25
86 #define QM_USERISADMIN 26
87 #define QM_USERISDEV 27
88 #define QM_WHOISHEADER 28
89 #define QM_WHOISCOLS 29
90 #define QM_USERONNOCHANS 30
91 #define QM_CHANAUTOLIMIT 31
92 #define QM_CHANBANAUTOREMOVE 32
93 #define QM_NOCHANBANAUTOREMOVE 33
94 #define QM_INVALIDCHANNAME 34
95 #define QM_ALREADYREGISTERED 35
96 #define QM_CURUSERFLAGS 36
97 #define QM_WELCOMEMESSAGEIS 37
98 #define QM_GLOBALINFO 38
99 #define QM_CHANNELINFO 39
100 #define QM_PROTECTEDNICK 40
101 #define QM_NICKWASFAKED 41
102 #define QM_NOTPROTECTED 42
103 #define QM_SAMEAUTH 43
104 #define QM_AUTHFAIL 44
105 #define QM_AUTHOK 45
106 #define QM_NEWACCOUNT 46
107 #define QM_AUTHNAMEINUSE 47
108 #define QM_ALREADYONCHAN 48
109 #define QM_NOTONCHAN 49
110 #define QM_ALREADYOPPED 50
111 #define QM_USERNOTONCHAN 51
112 #define QM_USEROPPEDONCHAN 52
113 #define QM_CANTOP 53
114 #define QM_NOTOPPED 54
115 #define QM_ALREADYVOICED 55
116 #define QM_NOTVOICED 56
117 #define QM_USERVOICEDONCHAN 57
118 #define QM_REGBANHEADER 58
119 #define QM_NOBANS 59
120 #define QM_REMOVEDCHANBAN 60
121 #define QM_NOTREMOVEDPERMBAN 61
122 #define QM_REMOVEDPERMBAN 62
123 #define QM_CANTVOICE 63
124 #define QM_NOHELP 64
125 #define QM_WHOISHEADER_NICK 65
126 #define QM_WHOISHEADER_AUTH 66
127 #define QM_WHOIS_USERS 67
128 #define QM_WHOIS_LASTAUTH 68
129 #define QM_WHOIS_LASTUSERHOST 69
130 #define QM_WHOIS_USERID 70
131 #define QM_WHOIS_INFO 71
132 #define QM_WHOIS_COMMENT 72
133 #define QM_WHOIS_FLAGS 73
134 #define QM_WHOIS_CREATED 74
135 #define QM_WHOIS_CHANHEADER 75
136 #define QM_WHOIS_EMAIL 76
137 #define QM_WHOIS_EMAILSET 77
138 #define QM_COMMENT 78
139 #define QM_NOCOMMENT 79
140 #define QM_BADAUTH 80
141 #define QM_USERHASBADAUTH 81
142 #define QM_BADEMAIL 82
143 #define QM_MAILTHROTTLED 83
144 #define QM_MAILQUEUED 84
145 #define QM_PWDONTMATCH 85
146 #define QM_PWTOSHORT 86
147 #define QM_PWCHANGED 87
148 #define QM_MASTERPWCHANGED 88
149 #define QM_EMAILCHANGED 89
150 #define QM_EMAILDONTMATCH 90
151 #define QM_INVALIDEMAIL 91
152 #define QM_EMAILTOOSHORT 92
153 #define QM_NOTYOUREMAIL 93
154 #define QM_EMAILNOAT 94
155 #define QM_EMAILATEND 95
156 #define QM_EMAILINVCHR 96
157 #define QM_CHANNELNOTSUSPENDED 97
158 #define QM_CHANNELALREADYSUSPENDED 98
159 #define QM_CHANTYPE 99
160 #define QM_UNKNOWNCHANTYPE 100
161 #define QM_FOUNDER 101
162 #define QM_ADDEDBY 102
163 #define QM_ALREADYKNOWNONCHAN 103
164 #define QM_CANNOTREMOVEOWNER 104
165 #define QM_CANNOTREMOVEMASTER 105
166 #define QM_UNKNOWNBAN 106
167 #define QM_YOURLANGUAGE 107
168 #define QM_LANGUAGELIST 108
169 #define QM_UNKNOWNLANGUAGE 109
170 #define QM_WHOIS_USERLANG 110
171 #define QM_CHANTYPEIS 111
172 #define QM_STATSHEADER 112
173 #define QM_STATSADDED 113
174 #define QM_STATSJOINS 114
175 #define QM_STATSLASTACTIVE 115
176 #define QM_AUTHSUSPENDED 116
177 #define QM_REASON 117
178 #define QM_EXPIRES 118
179 #define QM_TOOMANYAUTHS 119
180 #define QM_INVALIDDURATION 120
181 #define QM_DISCONNECTINGUSER 121
182 #define QM_USERALREADYSUSPENDED 122
183 #define QM_USERNOTSUSPENDED 123
184 #define QM_SPEWHEADER 124
185 #define QM_TOOMANYRESULTS 125
186 #define QM_RESULTCOUNT 126
187 #define QM_SUSPENDKILL 127
188 #define QM_LISTFLAGSHEADER 128
189 #define QM_SUSPENDUSERLISTHEADER 129
190 #define QM_SUSPENDCHANLISTHEADER 130
191 #define QM_NOREQUESTOWNER 131
192 #define QM_GRANTEDOWNER 132
193 #define QM_AUTHHISTORYHEADER 133
194 #define QM_CURDOMAINMODES 134
195 #define QM_SPEWDOMAINHEADER 135
196 #define QM_DOMAINLIMIT 136
197 #define QM_PWTOWEAK 137
198 #define QM_GIVEOWNERNOTMASTER 138
199 #define QM_GIVEOWNERALREADYOWNER 139
200 #define QM_GIVEOWNERNEEDHASH 140
201 #define QM_GIVEOWNERWRONGHASH 141
202 #define QM_SHOWINGDURATION 142
203
204 /* List of privileged operations */
205
206 #define QPRIV_SUSPENDBYPASS 1
207 #define QPRIV_VIEWCHANFLAGS 100
208 #define QPRIV_VIEWFULLCHANLEV 101
209 #define QPRIV_VIEWFULLWHOIS 102
210 #define QPRIV_VIEWCHANMODES 103
211 #define QPRIV_VIEWAUTOLIMIT 104
212 #define QPRIV_VIEWBANTIMER 105
213 #define QPRIV_VIEWUSERFLAGS 106
214 #define QPRIV_VIEWWELCOME 107
215 #define QPRIV_VIEWCOMMENTS 108
216 #define QPRIV_VIEWEMAIL 109
217
218 #define QPRIV_CHANGECHANFLAGS 200
219 #define QPRIV_CHANGECHANLEV 201
220 #define QPRIV_CHANGECHANMODES 202
221 #define QPRIV_CHANGEAUTOLIMIT 203
222 #define QPRIV_CHANGEBANTIMER 204
223 #define QPRIV_CHANGEUSERFLAGS 205
224 #define QPRIV_CHANGEWELCOME 206
225
226 /* List of access checks */
227
228 #define CA_AUTHED 0x0001
229 #define CA_TOPICPRIV 0x0008
230 #define CA_KNOWN 0x0010
231 #define CA_VOICEPRIV 0x0020
232 #define CA_OPPRIV 0x0040
233 #define CA_MASTERPRIV 0x0080
234 #define CA_OWNERPRIV 0x0100
235 /* SPARE 0x0200 */
236 #define CA_ONCHAN 0x0400
237 #define CA_OFFCHAN 0x0800
238 #define CA_OPPED 0x1000
239 #define CA_DEOPPED 0x2000
240 #define CA_VOICED 0x4000
241 #define CA_DEVOICED 0x8000
242
243 #define CA_NEEDKNOWN (CA_KNOWN|CA_OPPRIV|CA_MASTERPRIV|CA_TOPICPRIV|CA_OWNERPRIV)
244 #define CA_ONCHANREQ (CA_ONCHAN|CA_OPPED|CA_DEOPPED|CA_VOICED|CA_DEVOICED)
245
246
247 /* User flags */
248 #define QUFLAG_NEEDAUTH 0x0001 /* +l */
249 #define QUFLAG_GLINE 0x0002 /* +g */
250 #define QUFLAG_NOTICE 0x0004 /* +n */
251 #define QUFLAG_RESTRICTED 0x0008 /* +r */
252 #define QUFLAG_SUSPENDED 0x0010 /* +z */
253 #define QUFLAG_OPER 0x0020 /* +o */
254 #define QUFLAG_DEV 0x0040 /* +d */
255 #define QUFLAG_PROTECT 0x0080 /* +p */
256 #define QUFLAG_HELPER 0x0100 /* +h */
257 #define QUFLAG_ADMIN 0x0200 /* +a */
258 #define QUFLAG_INFO 0x0400 /* +i */
259 #define QUFLAG_DELAYEDGLINE 0x0800 /* +G */
260 #define QUFLAG_NOAUTHLIMIT 0x1000 /* +L */
261 #define QUFLAG_CLEANUPEXEMPT 0x4000 /* +D */
262 #define QUFLAG_ALL 0x1fff
263
264 #define UIsNeedAuth(x) ((x)->flags & QUFLAG_NEEDAUTH)
265 #define UIsGline(x) ((x)->flags & QUFLAG_GLINE)
266 #define UIsNotice(x) ((x)->flags & QUFLAG_NOTICE)
267 #define UIsRestricted(x) ((x)->flags & QUFLAG_RESTRICTED)
268 #define UIsSuspended(x) ((x)->flags & QUFLAG_SUSPENDED)
269 #define UIsOper(x) ((x)->flags & QUFLAG_OPER)
270 #define UIsDev(x) ((x)->flags & QUFLAG_DEV)
271 #define UIsProtect(x) ((x)->flags & QUFLAG_PROTECT)
272 #define UIsHelper(x) ((x)->flags & QUFLAG_HELPER)
273 #define UIsAdmin(x) ((x)->flags & QUFLAG_ADMIN)
274 #define UIsInfo(x) ((x)->flags & QUFLAG_INFO)
275 #define UIsDelayedGline(x) ((x)->flags & QUFLAG_DELAYEDGLINE)
276 #define UIsNoAuthLimit(x) ((x)->flags & QUFLAG_NOAUTHLIMIT)
277 #define UIsCleanupExempt(x) ((x)->flags & QUFLAG_CLEANUPEXEMPT)
278
279 #define UHasSuspension(x) ((x)->flags & (QUFLAG_GLINE|QUFLAG_DELAYEDGLINE|QUFLAG_SUSPENDED|QUFLAG_NEEDAUTH))
280
281 #define UHasHelperPriv(x) ((x)->flags & (QUFLAG_HELPER | QUFLAG_OPER | QUFLAG_ADMIN | QUFLAG_DEV))
282 #define UHasOperPriv(x) ((x)->flags & (QUFLAG_OPER | QUFLAG_ADMIN | QUFLAG_DEV))
283 #define UHasAdminPriv(x) ((x)->flags & (QUFLAG_ADMIN | QUFLAG_DEV))
284
285 #define USetNeedAuth(x) ((x)->flags |= QUFLAG_NEEDAUTH)
286 #define USetGline(x) ((x)->flags |= QUFLAG_GLINE)
287 #define USetNotice(x) ((x)->flags |= QUFLAG_NOTICE)
288 #define USetRestricted(x) ((x)->flags |= QUFLAG_RESTRICTED)
289 #define USetSuspended(x) ((x)->flags |= QUFLAG_SUSPENDED)
290 #define USetOper(x) ((x)->flags |= QUFLAG_OPER)
291 #define USetDev(x) ((x)->flags |= QUFLAG_DEV)
292 #define USetProtect(x) ((x)->flags |= QUFLAG_PROTECT)
293 #define USetHelper(x) ((x)->flags |= QUFLAG_HELPER)
294 #define USetAdmin(x) ((x)->flags |= QUFLAG_ADMIN)
295 #define USetInfo(x) ((x)->flags |= QUFLAG_INFO)
296 #define USetDelayedGline(x) ((x)->flags |= QUFLAG_DELAYEDGLINE)
297 #define USetNoAuthLimit(x) ((x)->flags |= QUFLAG_NOAUTHLIMIT)
298 #define USetCleanupExempt(x) ((x)->flags |= QUFLAG_CLEANUPEXEMPT)
299 #define USetTrust(x) ((x)->flags |= QUFLAG_TRUST)
300
301 #define UClearNeedAuth(x) ((x)->flags &= ~QUFLAG_NEEDAUTH)
302 #define UClearGline(x) ((x)->flags &= ~QUFLAG_GLINE)
303 #define UClearNotice(x) ((x)->flags &= ~QUFLAG_NOTICE)
304 #define UClearRestricted(x) ((x)->flags &= ~QUFLAG_RESTRICTED)
305 #define UClearSuspended(x) ((x)->flags &= ~QUFLAG_SUSPENDED)
306 #define UClearOper(x) ((x)->flags &= ~QUFLAG_OPER)
307 #define UClearDev(x) ((x)->flags &= ~QUFLAG_DEV)
308 #define UClearProtect(x) ((x)->flags &= ~QUFLAG_PROTECT)
309 #define UClearHelper(x) ((x)->flags &= ~QUFLAG_HELPER)
310 #define UClearAdmin(x) ((x)->flags &= ~QUFLAG_ADMIN)
311 #define UClearInfo(x) ((x)->flags &= ~QUFLAG_INFO)
312 #define UClearDelayedGline(x) ((x)->flags &= ~QUFLAG_DELAYEDGLINE)
313 #define UClearNoAuthLimit(x) ((x)->flags &= ~QUFLAG_NOAUTHLIMIT)
314 #define UClearCleanupExempt(x) ((x)->flags &= ~QUFLAG_CLEANUPEXEMPT)
315 #define UClearTrust(x) ((x)->flags &= ~QUFLAG_TRUST)
316
317 /* email */
318 #define MAX_RESEND_TIME 2*3600L /* cooling off period */
319 #define VALID_EMAIL "^[-_.+[:alpha:][:digit:]]+(\\.[-_[:digit:][:alpha:]]+)*@([[:digit:][:alpha:]](-?[[:digit:][:alpha:]])*\\.)+[[:alpha:]]{2}([zmuvtgo]|fo|me|seum|op|ro)?$"
320
321 #define QMAIL_NEWACCOUNT 1 /* new account */
322 #define QMAIL_REQPW 2 /* requestpassword */
323 #define QMAIL_NEWPW 3 /* new password */
324 #define QMAIL_NEWMASTERPW 4 /* new master password */
325 #define QMAIL_NEWEMAIL 5 /* new email address */
326
327
328 /* Channel flags */
329 #define QCFLAG_AUTOOP 0x0001 /* +a */
330 #define QCFLAG_BITCH 0x0002 /* +b */
331 #define QCFLAG_AUTOLIMIT 0x0004 /* +c */
332 #define QCFLAG_ENFORCE 0x0008 /* +e */
333 #define QCFLAG_FORCETOPIC 0x0010 /* +f */
334 #define QCFLAG_AUTOVOICE 0x0020 /* +g */
335 #define QCFLAG_INFO 0x0040 /* +i */
336 #define QCFLAG_JOINED 0x0080 /* +j */
337 #define QCFLAG_KNOWNONLY 0x0100 /* +k */
338 #define QCFLAG_PROTECT 0x0200 /* +p */
339 #define QCFLAG_SPAMPROT 0x0400 /* +s */
340 #define QCFLAG_TOPICSAVE 0x0800 /* +t */
341 #define QCFLAG_VOICEALL 0x1000 /* +v */
342 #define QCFLAG_WELCOME 0x2000 /* +w */
343 #define QCFLAG_SUSPENDED 0x4000 /* +z */
344
345 #define CIsAutoOp(x) ((x)->flags & QCFLAG_AUTOOP)
346 #define CIsBitch(x) ((x)->flags & QCFLAG_BITCH)
347 #define CIsAutoLimit(x) ((x)->flags & QCFLAG_AUTOLIMIT)
348 #define CIsEnforce(x) ((x)->flags & QCFLAG_ENFORCE)
349 #define CIsForceTopic(x) ((x)->flags & QCFLAG_FORCETOPIC)
350 #define CIsAutoVoice(x) ((x)->flags & QCFLAG_AUTOVOICE)
351 #define CIsJoined(x) ((x)->flags & QCFLAG_JOINED)
352 #define CIsKnownOnly(x) ((x)->flags & QCFLAG_KNOWNONLY)
353 #define CIsProtect(x) ((x)->flags & QCFLAG_PROTECT)
354 #define CIsSpamProt(x) ((x)->flags & QCFLAG_SPAMPROT)
355 #define CIsTopicSave(x) ((x)->flags & QCFLAG_TOPICSAVE)
356 #define CIsVoiceAll(x) ((x)->flags & QCFLAG_VOICEALL)
357 #define CIsWelcome(x) ((x)->flags & QCFLAG_WELCOME)
358 #define CIsSuspended(x) ((x)->flags & QCFLAG_SUSPENDED)
359 #define CIsInfo(x) ((x)->flags & QCFLAG_INFO)
360
361 #define CSetAutoOp(x) ((x)->flags |= QCFLAG_AUTOOP)
362 #define CSetBitch(x) ((x)->flags |= QCFLAG_BITCH)
363 #define CSetAutoLimit(x) ((x)->flags |= QCFLAG_AUTOLIMIT)
364 #define CSetEnforce(x) ((x)->flags |= QCFLAG_ENFORCE)
365 #define CSetForceTopic(x) ((x)->flags |= QCFLAG_FORCETOPIC)
366 #define CSetAutoVoice(x) ((x)->flags |= QCFLAG_AUTOVOICE)
367 #define CSetJoined(x) ((x)->flags |= QCFLAG_JOINED)
368 #define CSetKnownOnly(x) ((x)->flags |= QCFLAG_KNOWNONLY)
369 #define CSetProtect(x) ((x)->flags |= QCFLAG_PROTECT)
370 #define CSetSpamProt(x) ((x)->flags |= QCFLAG_SPAMPROT)
371 #define CSetTopicSave(x) ((x)->flags |= QCFLAG_TOPICSAVE)
372 #define CSetVoiceAll(x) ((x)->flags |= QCFLAG_VOICEALL)
373 #define CSetWelcome(x) ((x)->flags |= QCFLAG_WELCOME)
374 #define CSetSuspended(x) ((x)->flags |= QCFLAG_SUSPENDED)
375
376 #define CClearAutoOp(x) ((x)->flags &= ~QCFLAG_AUTOOP)
377 #define CClearBitch(x) ((x)->flags &= ~QCFLAG_BITCH)
378 #define CClearAutoLimit(x) ((x)->flags &= ~QCFLAG_AUTOLIMIT)
379 #define CClearEnforce(x) ((x)->flags &= ~QCFLAG_ENFORCE)
380 #define CClearForceTopic(x) ((x)->flags &= ~QCFLAG_FORCETOPIC)
381 #define CClearAutoVoice(x) ((x)->flags &= ~QCFLAG_AUTOVOICE)
382 #define CClearJoined(x) ((x)->flags &= ~QCFLAG_JOINED)
383 #define CClearKnownOnly(x) ((x)->flags &= ~QCFLAG_KNOWNONLY)
384 #define CClearProtect(x) ((x)->flags &= ~QCFLAG_PROTECT)
385 #define CClearSpamProt(x) ((x)->flags &= ~QCFLAG_SPAMPROT)
386 #define CClearTopicSave(x) ((x)->flags &= ~QCFLAG_TOPICSAVE)
387 #define CClearVoiceAll(x) ((x)->flags &= ~QCFLAG_VOICEALL)
388 #define CClearWelcome(x) ((x)->flags &= ~QCFLAG_WELCOME)
389 #define CClearSuspended(x) ((x)->flags &= ~QCFLAG_SUSPENDED)
390
391 #define QCFLAG_USERCONTROL (QCFLAG_AUTOOP|QCFLAG_BITCH|QCFLAG_AUTOLIMIT| \
392 QCFLAG_ENFORCE|QCFLAG_FORCETOPIC|QCFLAG_AUTOVOICE| \
393 QCFLAG_JOINED|QCFLAG_PROTECT|QCFLAG_INFO| \
394 QCFLAG_SPAMPROT|QCFLAG_TOPICSAVE|QCFLAG_VOICEALL| \
395 QCFLAG_WELCOME|QCFLAG_KNOWNONLY)
396
397 #define QCFLAG_ALL 0x7fff
398
399
400 /* Channel user ("chanlev") flags */
401 /* Slightly funny order here: list the "biggest" flags at the
402 * top so we can do sorted "chanlev" output more easily */
403 #define QCUFLAG_OWNER 0x8000 /* +n */
404 #define QCUFLAG_MASTER 0x4000 /* +m */
405 #define QCUFLAG_OP 0x2000 /* +o */
406 #define QCUFLAG_VOICE 0x1000 /* +v */
407 #define QCUFLAG_AUTOOP 0x0001 /* +a */
408 #define QCUFLAG_BANNED 0x0002 /* +b */
409 #define QCUFLAG_DENY 0x0004 /* +d */
410 #define QCUFLAG_AUTOVOICE 0x0008 /* +g */
411 #define QCUFLAG_QUIET 0x0010 /* +q */
412 #define QCUFLAG_SPAMCON 0x0020 /* +s */
413 #define QCUFLAG_TOPIC 0x0040 /* +t */
414 #define QCUFLAG_HIDEWELCOME 0x0080 /* +w */
415 #define QCUFLAG_PROTECT 0x0100 /* +p */
416 #define QCUFLAG_HIDEINFO 0x0200 /* +i */
417 #define QCUFLAG_KNOWN 0x0400 /* +k */
418 #define QCUFLAG_AUTOINVITE 0x0800 /* +j */
419
420 #define QCUFLAG_SIGNIFICANT (QCUFLAG_MASTER|QCUFLAG_OWNER|QCUFLAG_OP)
421
422 #define QCUFLAG_MASTERCON (QCUFLAG_AUTOOP|QCUFLAG_BANNED|QCUFLAG_DENY| \
423 QCUFLAG_GIVE|QCUFLAG_OP|QCUFLAG_QUIET|QCUFLAG_TOPIC| \
424 QCUFLAG_VOICE|QCUFLAG_PROTECT)
425
426 #define QCUFLAG_SELFCON (QCUFLAG_OP | QCUFLAG_VOICE | QCUFLAG_AUTOOP | QCUFLAG_AUTOVOICE | \
427 QCUFLAG_SPAMCON | QCUFLAG_TOPIC | QCUFLAG_HIDEINFO)
428
429 #define QCUFLAG_ALL 0xffff
430
431 #define CUIsOwner(x) ((x)->flags & QCUFLAG_OWNER)
432 #define CUIsMaster(x) ((x)->flags & QCUFLAG_MASTER)
433 #define CUIsOp(x) ((x)->flags & QCUFLAG_OP)
434 #define CUIsVoice(x) ((x)->flags & QCUFLAG_VOICE)
435 #define CUIsAutoOp(x) ((x)->flags & QCUFLAG_AUTOOP)
436 #define CUIsBanned(x) ((x)->flags & QCUFLAG_BANNED)
437 #define CUIsDeny(x) ((x)->flags & QCUFLAG_DENY)
438 #define CUIsAutoVoice(x) ((x)->flags & QCUFLAG_AUTOVOICE)
439 #define CUIsQuiet(x) ((x)->flags & QCUFLAG_QUIET)
440 #define CUIsSpamCon(x) ((x)->flags & QCUFLAG_SPAMCON)
441 #define CUIsTopic(x) ((x)->flags & QCUFLAG_TOPIC)
442 #define CUIsHideWelcome(x) ((x)->flags & QCUFLAG_HIDEWELCOME)
443 #define CUIsProtect(x) ((x)->flags & QCUFLAG_PROTECT)
444 #define CUIsHideInfo(x) ((x)->flags & QCUFLAG_HIDEINFO)
445 #define CUIsKnown(x) ((x)->flags & QCUFLAG_KNOWN)
446 #define CUIsAutoInvite(x) ((x)->flags & QCUFLAG_AUTOINVITE)
447
448 #define CUKnown(x) (CUIsKnown(x) || CUHasVoicePriv(x))
449 #define CUHasVoicePriv(x) ((x)->flags & (QCUFLAG_VOICE | QCUFLAG_OP | QCUFLAG_MASTER | QCUFLAG_OWNER))
450 #define CUHasOpPriv(x) ((x)->flags & (QCUFLAG_OP | QCUFLAG_MASTER | QCUFLAG_OWNER))
451 #define CUHasMasterPriv(x) ((x)->flags & (QCUFLAG_MASTER | QCUFLAG_OWNER))
452 #define CUHasTopicPriv(x) ((x)->flags & (QCUFLAG_MASTER | QCUFLAG_OWNER | QCUFLAG_TOPIC))
453
454 #define CUSetOwner(x) ((x)->flags |= QCUFLAG_OWNER)
455 #define CUSetMaster(x) ((x)->flags |= QCUFLAG_MASTER)
456 #define CUSetOp(x) ((x)->flags |= QCUFLAG_OP)
457 #define CUSetVoice(x) ((x)->flags |= QCUFLAG_VOICE)
458 #define CUSetAutoOp(x) ((x)->flags |= QCUFLAG_AUTOOP)
459 #define CUSetBanned(x) ((x)->flags |= QCUFLAG_BANNED)
460 #define CUSetDeny(x) ((x)->flags |= QCUFLAG_DENY)
461 #define CUSetAutoVoice(x) ((x)->flags |= QCUFLAG_AUTOVOICE)
462 #define CUSetQuiet(x) ((x)->flags |= QCUFLAG_QUIET)
463 #define CUSetSpamCon(x) ((x)->flags |= QCUFLAG_SPAMCON)
464 #define CUSetTopic(x) ((x)->flags |= QCUFLAG_TOPIC)
465 #define CUSetHideWelcome(x) ((x)->flags |= QCUFLAG_HIDEWELCOME)
466 #define CUSetKnown(x) ((x)->flags |= QCUFLAG_KNOWN)
467 #define CUSetAutoInvite(x) ((x)->flags |= QCUFLAG_AUTOINVITE)
468
469 #define CUClearOwner(x) ((x)->flags &= ~QCUFLAG_OWNER)
470 #define CUClearMaster(x) ((x)->flags &= ~QCUFLAG_MASTER)
471 #define CUClearOp(x) ((x)->flags &= ~QCUFLAG_OP)
472 #define CUClearVoice(x) ((x)->flags &= ~QCUFLAG_VOICE)
473 #define CUClearAutoOp(x) ((x)->flags &= ~QCUFLAG_AUTOOP)
474 #define CUClearBanned(x) ((x)->flags &= ~QCUFLAG_BANNED)
475 #define CUClearDeny(x) ((x)->flags &= ~QCUFLAG_DENY)
476 #define CUClearAutoVoice(x) ((x)->flags &= ~QCUFLAG_AUTOVOICE)
477 #define CUClearQuiet(x) ((x)->flags &= ~QCUFLAG_QUIET)
478 #define CUClearSpamCon(x) ((x)->flags &= ~QCUFLAG_SPAMCON)
479 #define CUClearTopic(x) ((x)->flags &= ~QCUFLAG_TOPIC)
480 #define CUClearHideWelcome(x) ((x)->flags &= ~QCUFLAG_HIDEWELCOME)
481 #define CUClearKnown(x) ((x)->flags &= ~QCUFLAG_KNOWN)
482 #define CUClearAutoInvite(x) ((x)->flags &= ~QCUFLAG_AUTOINVITE)
483
484 #define QCSTAT_OPCHECK 0x0001 /* Do op check */
485 #define QCSTAT_MODECHECK 0x0002 /* Do mode check */
486 #define QCSTAT_BANCHECK 0x0004 /* Do ban check */
487
488 #define QUSTAT_DEAD 0x8000 /* User has been deleted.. */
489
490 #define QCMD_SECURE 0x0001 /* Must use "user@server" to use this command */
491 #define QCMD_AUTHED 0x0002 /* Only available to authed users */
492 #define QCMD_NOTAUTHED 0x0004 /* Only available to NON-authed users */
493
494 #define QCMD_HELPER 0x0010 /* Only available to helpers */
495 #define QCMD_OPER 0x0020 /* Only available to opers */
496 #define QCMD_ADMIN 0x0040 /* Only available to admins */
497 #define QCMD_DEV 0x0080 /* Only available to developers */
498
499 #define QCMD_ALIAS 0x0100 /* Don't list on SHOWCOMMANDS */
500
501 #define CS_INIT_DB 0x1 /* Loading database.. */
502 #define CS_INIT_NOUSER 0x2 /* Loaded DB, waiting for user to be created */
503 #define CS_INIT_READY 0x3 /* Ready for action! */
504
505 struct regchanuser;
506 struct reguser;
507
508 typedef struct maildomain {
509 #ifdef CS_PARANOID
510 unsigned int maildomain_magic;
511 #endif
512 unsigned int ID;
513 sstring *name;
514 unsigned int count;
515 unsigned int limit;
516 unsigned int actlimit;
517 flag_t flags;
518 struct reguser *users;
519 struct maildomain *parent;
520 struct maildomain *nextbyname;
521 struct maildomain *nextbyID;
522 } maildomain;
523
524 #define MDFLAG_LIMIT 0x0001 /* +l */
525 #define MDFLAG_BANNED 0x0002 /* +b */
526 #define MDFLAG_ACTLIMIT 0x0004 /* +u */
527 #define MDFLAG_ALL 0x0007
528
529 #define MDHasLimit(x) ((x)->flags & MDFLAG_LIMIT)
530 #define MDSetLimit(x) ((x)->flags |= MDFLAG_LIMIT)
531 #define MDClearLimit(x) ((x)->flags &= ~MDFLAG_LIMIT)
532 #define MDIsBanned(x) ((x)->flags & MDFLAG_BANNED)
533 #define MDSetBanned(x) ((x)->flags |= MDFLAG_BANNED)
534 #define MDClearBanned(x) ((x)->flags &= ~MDFLAG_BANNED)
535 #define MDHasActLimit(x) ((x)->flags & MDFLAG_ACTLIMIT)
536 #define MDSetActLimit(x) ((x)->flags |= MDFLAG_ACTLIMIT)
537 #define MDClearActLimit(x) ((x)->flags &= ~MDFLAG_ACTLIMIT)
538
539 /* "Q" ban */
540 typedef struct regban {
541 #ifdef CS_PARANOID
542 unsigned int regchanban_magic;
543 #endif
544 unsigned int ID; /* ID in the database */
545 struct chanban *cbp; /* Standard chanban struct */
546 unsigned int setby; /* Who set the ban */
547 time_t expiry; /* When the ban expires */
548 sstring *reason; /* Reason to attach to related kicks */
549 struct regban *next; /* Next ban on this channel */
550 } regban;
551
552 /* Registered channel */
553 typedef struct regchan {
554 #ifdef CS_PARANOID
555 unsigned int regchan_magic;
556 #endif
557 unsigned int ID; /* Unique number from database */
558 chanindex *index; /* Pointer to the channel index record */
559 time_t ltimestamp; /* The last timestamp we saw on this channel */
560
561 flag_t flags; /* Chanflags */
562 flag_t status; /* Runtime status codes */
563 flag_t forcemodes; /* Forced modes */
564 flag_t denymodes; /* Denied modes */
565
566 short limit; /* Limit to enforce if +l is set */
567 short autolimit; /* How many slots to leave when autolimiting */
568 short banstyle; /* Ban style for +b type bans */
569
570 time_t created; /* When the service was added */
571 time_t lastactive; /* When the channel was last "active" */
572 time_t statsreset; /* When the users stats were last reset */
573 time_t ostatsreset; /* When the oper stats were last reset */
574 time_t banduration; /* How long to remove bans after (0=don't) */
575 time_t autoupdate; /* When the autolimit next needs checking */
576 time_t lastbancheck; /* Timestamp of last ban check */
577 time_t lastcountersync; /* When the counters were last synced.. */
578 time_t lastpart; /* When the last user left the channel */
579
580 unsigned int founder; /* founder */
581 unsigned int addedby; /* oper adding chan */
582 unsigned int suspendby; /* who suspended chan */
583
584 short chantype; /* What "type" the channel is */
585
586 unsigned int totaljoins; /* Total joins since created */
587 unsigned int tripjoins; /* Total joins since last stats reset */
588 unsigned int otripjoins; /* Total joins since last oper stats reset */
589 unsigned int maxusers; /* Max users since created */
590 unsigned int tripusers; /* Max users since last stats reset */
591 unsigned int otripusers; /* Max users since last oper stats reset */
592
593 sstring *welcome; /* Welcome message */
594 sstring *topic; /* "default" topic set by settopic */
595 sstring *key; /* Key as enforced by +k */
596 sstring *suspendreason; /* Suspend reason */
597 sstring *comment; /* Oper-settable channel comment */
598
599 void *checksched; /* Handle for channel check schedule */
600
601 struct regchanuser *regusers[REGCHANUSERHASHSIZE];
602 struct regban *bans; /* List of bans on the channel */
603 } regchan;
604
605 /* Little list thing: which network users are authed
606 * as this user */
607 typedef struct nicklist {
608 nick *np;
609 struct nicklist *next;
610 } nicklist;
611
612 /* Registered user */
613 typedef struct reguser {
614 #ifdef CS_PARANOID
615 unsigned int reguser_magic;
616 #endif
617
618 unsigned int ID; /* From the database */
619
620 char username[NICKLEN+1];
621
622 time_t created;
623 time_t lastauth;
624 time_t lastemailchange;
625
626 flag_t flags; /* user flags */
627 flag_t status; /* runtime status */
628 short languageid; /* what language to speak to the user */
629
630 unsigned int suspendby; /* Userid of oper who suspended this user */
631 time_t suspendexp; /* Expiry date of suspension */
632
633 char password[PASSLEN+1];
634 char masterpass[PASSLEN+1];
635
636 sstring *localpart;
637 maildomain *domain;
638
639 sstring *email; /* Registered e-mail */
640 sstring *lastuserhost; /* Last user@host */
641 sstring *suspendreason; /* Why the account is suspended */
642 sstring *comment; /* Oper-settable user comment */
643 sstring *info; /* User-settable info line */
644
645 struct regchanuser *knownon; /* Which channels this user is known on */
646
647 struct nicklist *nicks; /* Which nicks are authed as this user */
648
649 /* These fields are for the nick protection system */
650 void *checkshd; /* When we're going to check for an imposter */
651 int stealcount; /* How many times we've had to free the nick up */
652 nick *fakeuser; /* If we had to "take" the nick, here's the pointer */
653
654 struct reguser *nextbydomain;
655 struct reguser *nextbyname;
656 struct reguser *nextbyID;
657 } reguser;
658
659 /* Registered channel user */
660 typedef struct regchanuser {
661 #ifdef CS_PARANOID
662 unsigned int regchanuser_magic;
663 #endif
664 struct reguser *user;
665 struct regchan *chan;
666 flag_t flags;
667 time_t changetime; /* Timestamp of last "significant" change */
668 time_t usetime; /* Timestamp of last use */
669 sstring *info; /* User-settable info line */
670 struct regchanuser *nextbyuser;
671 struct regchanuser *nextbychan;
672 } regchanuser;
673
674 typedef struct cslang {
675 char code[3];
676 sstring *name;
677 } cslang;
678
679 typedef struct cmdsummary {
680 sstring *def;
681 sstring *bylang[MAXLANG];
682 } cmdsummary;
683
684 typedef struct activeuser {
685 #ifdef CS_PARANOID
686 unsigned int activeuser_magic;
687 #endif
688 reguser* rup; /* pointer to auth data */
689 int authattempts; /* number of times user has attempted to auth */
690 struct activeuser *next; /* purely for keeping track of free, but not free'd structures */
691 } activeuser;
692
693 #ifdef CS_PARANOID
694
695 #define REGUSERMAGIC 0x4d42de03
696 #define REGCHANMAGIC 0x5bf2aa30
697 #define REGCHANUSERMAGIC 0x19628b63
698 #define REGCHANBANMAGIC 0x5a6f555a
699 #define ACTIVEUSERMAGIC 0x897f98a0
700 #define MAILDOMAINMAGIC 0x27cde46f
701
702 #define verifyreguser(x) assert((x)->reguser_magic == REGUSERMAGIC)
703 #define verifyregchan(x) assert((x)->regchan_magic == REGCHANMAGIC)
704 #define verifyregchanuser(x) assert((x)->regchanuser_magic == REGCHANUSERMAGIC)
705 #define verifyregchanban(x) assert((x)->regchanban_magic == REGCHANBANMAGIC)
706 #define verifyactiveuser(x) assert((x)->activeuser_magic == ACTIVEUSERMAGIC)
707 #define verifymaildomain(x) assert((x)->maildomain_magic == MAILDOMAINMAGIC)
708
709 #define tagreguser(x) ((x)->reguser_magic = REGUSERMAGIC)
710 #define tagregchan(x) ((x)->regchan_magic = REGCHANMAGIC)
711 #define tagregchanuser(x) ((x)->regchanuser_magic = REGCHANUSERMAGIC)
712 #define tagregchanban(x) ((x)->regchanban_magic = REGCHANBANMAGIC)
713 #define tagactiveuser(x) ((x)->activeuser_magic = ACTIVEUSERMAGIC)
714 #define tagmaildomain(x) ((x)->maildomain_magic = MAILDOMAINMAGIC)
715
716 #else
717
718 #define verifyreguser(x)
719 #define verifyregchan(x)
720 #define verifyregchanuser(x)
721 #define verifyregchanban(x)
722 #define verifyactiveuser(x)
723 #define verifymaildomain(x)
724
725 #define tagreguser(x)
726 #define tagregchan(x)
727 #define tagregchanuser(x)
728 #define tagregchanban(x)
729 #define tagactiveuser(x)
730 #define tagmaildomain(x)
731
732 #endif
733
734 #define getactiveuserfromnick(x) ((activeuser*)(x)->exts[chanservnext])
735 #define getreguserfromnick(x) (getactiveuserfromnick(x)?getactiveuserfromnick(x)->rup:NULL)
736
737 /* Global variables for chanserv module */
738 extern unsigned int lastuserID;
739 extern unsigned int lastchannelID;
740 extern unsigned int lastbanID;
741 extern unsigned int lastdomainID;
742
743 extern int chanserv_init_status;
744 extern int chanservdb_ready;
745
746 extern maildomain *maildomainnametable[MAILDOMAINHASHSIZE];
747 extern maildomain *maildomainIDtable[MAILDOMAINHASHSIZE];
748
749 extern reguser *regusernicktable[REGUSERHASHSIZE];
750 extern reguser *deadusers;
751
752 extern nick *chanservnick;
753 extern int chanservext;
754 extern int chanservnext;
755 extern int chanservaext;
756
757 extern cslang *cslanguages[MAXLANG];
758 extern unsigned int cslangcount;
759
760 extern sstring *csmessages[MAXLANG][MAXMESSAGES];
761 extern char *defaultmessages[MAXMESSAGES];
762
763 extern const flag rcflags[];
764 extern const flag rcuflags[];
765 extern const flag ruflags[];
766 extern const flag mdflags[];
767
768 extern CommandTree *cscommands;
769
770 extern sstring **chantypes;
771
772 /* Function prototypes */
773
774 /* chanserv.c */
775 void chanserv_finalinit();
776
777 /* chanservalloc.c */
778 void chanservallocinit();
779 void csfreeall();
780 regchan *getregchan();
781 void freeregchan(regchan *rcp);
782 reguser *getreguser();
783 void freereguser(reguser *rup);
784 regchanuser *getregchanuser();
785 void freeregchanuser(regchanuser *rcup);
786 nicklist *getnicklist();
787 void freenicklist(nicklist *nlp);
788 regban *getregban();
789 void freeregban(regban *rbp);
790 activeuser *getactiveuser();
791 void freeactiveuser(activeuser *aup);
792 maildomain *getmaildomain();
793 void freemaildomain(maildomain *mdp);
794
795 /* chanservhash.c */
796 void chanservhashinit();
797 void addregusertohash(reguser *rup);
798 reguser *findreguserbyID(unsigned int ID);
799 reguser *findreguserbynick(const char *nick);
800 reguser *findreguser(nick *sender, const char *str);
801 void removereguserfromhash(reguser *rup);
802 void addregchantohash(regchan *rcp);
803 regchan *findregchanbyID(unsigned int ID);
804 regchan *findregchanbyname(const char *name);
805 void removeregchanfromhash(regchan *rcp);
806 void addregusertochannel(regchanuser *rcup);
807 regchanuser *findreguseronchannel(regchan *rcp, reguser *rup);
808 void delreguserfromchannel(regchan *rcp, reguser *rup);
809 void addmaildomaintohash(maildomain *mdp);
810 maildomain *findmaildomainbyID(unsigned int ID);
811 maildomain *findmaildomainbydomain(char *domain);
812 maildomain *findmaildomainbyemail(char *email);
813 maildomain *findorcreatemaildomain(char *email);
814 void removemaildomainfromhash(maildomain *mdp);
815 void addregusertomaildomain(reguser *rup, maildomain *mdp);
816 void delreguserfrommaildomain(reguser *rup, maildomain *mdp);
817
818 /* chanservdb.c */
819 int chanservdbinit();
820 void loadmessages();
821 void loadcommandsummary(Command *cmd);
822 void chanservdbclose();
823 void csdb_updatetopic(regchan *rcp);
824 void csdb_updatelastjoin(regchanuser *rcup);
825 void csdb_updateauthinfo(reguser *rup);
826 void csdb_updatechannel(regchan *rcp);
827 void csdb_createchannel(regchan *rcp);
828 void csdb_deletechannel(regchan *rcp);
829 void csdb_deleteuser(reguser *rup);
830 void csdb_updatechannelcounters(regchan *rcp);
831 void csdb_updatechanneltimestamp(regchan *rcp);
832 void csdb_updatechanuser(regchanuser *rcup);
833 void csdb_createchanuser(regchanuser *rcup);
834 void csdb_deletechanuser(regchanuser *rcup);
835 void csdb_createuser(reguser *rup);
836 void csdb_updateuser(reguser *rup);
837 void csdb_createban(regchan *rcp, regban *rbp);
838 void csdb_deleteban(regban *rbp);
839 char *csdb_gethelpstr(char *command, int language);
840 void csdb_createmail(reguser *rup, int type);
841 void csdb_dohelp(nick *np, Command *cmd);
842
843 /* chanservuser.c */
844 void chanservreguser(void *arg);
845 void chanservjoinchan(channel *cp);
846 void chanservsendmessage(nick *np, char *message, ... );
847 void chanservwallmessage(char *message, ... );
848 void chanservcommandinit();
849 void chanservcommandclose();
850 void chanservstdmessage(nick *np, int messageid, ... );
851 void chanservaddcommand(char *command, int flags, int maxparams, CommandHandler handler, char *description);
852 void chanservremovecommand(char *command, CommandHandler handler);
853 void chanservaddctcpcommand(char *command, CommandHandler hander);
854 void chanservremovectcpcommand(char *command, CommandHandler handler);
855 void chanservkillstdmessage(nick *target, int messageid, ... );
856 int checkmasterpassword(reguser *rup, const char *pass);
857 int checkpassword(reguser *rup, const char *pass);
858 int setmasterpassword(reguser *rup, const char *pass);
859 int setpassword(reguser *rup, const char *pass);
860 /*reguser *getreguserfromnick(nick *np);
861 activeuser *getactiveuserfromnick(nick *np);*/
862 void cs_checknick(nick *np);
863 void cs_checkchanmodes(channel *cp);
864 void cs_docheckchanmodes(channel *cp, modechanges *changes);
865 void cs_docheckopvoice(channel *cp, modechanges *changes);
866 void cs_checkbans(channel *cp);
867 void cs_schedupdate(chanindex *cip, int mintime, int maxtime);
868 void cs_timerfunc(void *arg);
869 void cs_removechannel(regchan *rcp);
870 void cs_doallautomodes(nick *np);
871 void cs_checknickbans(nick *np);
872 void cs_setregban(chanindex *cip, regban *rbp);
873 int cs_bancheck(nick *np, channel *cp);
874 void cs_banuser(modechanges *changes, chanindex *cip, nick *np, const char *reason);
875 void cs_removeuser(reguser *rup);
876
877 /* chanservstdcmds.c */
878 int cs_doshowcommands(void *source, int cargc, char **cargv);
879 int cs_dohelp(void *source, int cargc, char **cargv);
880 int cs_doquit(void *source, int cargc, char **cargv);
881 int cs_dorename(void *source, int cargc, char **cargv);
882 int cs_dorehash(void *source, int cargc, char **cargv);
883 int cs_doversion(void *source, int cargc, char **cargv);
884 int cs_doctcpping(void *source, int cargc, char **cargv);
885 int cs_doctcpversion(void *source, int cargc, char **cargv);
886 int cs_doctcpgender(void *source, int cargc, char **cargv);
887
888 /* chanservnetevents.c */
889 void cs_handlenick(int hooknum, void *arg);
890 void cs_handlesethost(int hooknum, void *arg);
891 void cs_handlelostnick(int hooknum, void *arg);
892 void cs_handlenewchannel(int hooknum, void *arg);
893 void cs_handlelostchannel(int hooknum, void *arg);
894 void cs_handlejoin(int hooknum, void *arg);
895 void cs_handlemodechange(int hooknum, void *arg);
896 void cs_handleburst(int hooknum, void *arg);
897 void cs_handletopicchange(int hooknum, void *arg);
898 void cs_handleopchange(int hooknum, void *arg);
899 void cs_handlenewban(int hooknum, void *arg);
900 void cs_handlechanlostuser(int hooknum, void *arg);
901
902 /* chanservmessages.c */
903 void initmessages();
904
905 /* chanservprivs.c */
906 int cs_privcheck(int privnum, nick *np);
907 chanindex *cs_checkaccess(nick *np, const char *chan, unsigned int flags, chanindex *cip, const char *cmdname, int priv, int quiet);
908
909 /* chanservlog.c */
910 void cs_initlog();
911 void cs_closelog();
912 void cs_log(nick *np, char *event, ...);
913
914 /* chanservdump.c */
915 int dumplastjoindata(const char *filename);
916 int readlastjoindata(const char *filename);
917
918 /* chanservschedule.c */
919 void chanservdgline(void *arg);
920
921 /* authlib.c */
922 int csa_checkeboy(nick *sender, char *eboy);
923 void csa_createrandompw(char *pw, int n);
924 int csa_checkthrottled(nick *sender, reguser *rup, char *s);
925
926 /* chanservdb_updates.c */
927 void csdb_updateauthinfo(reguser *rup);
928 void csdb_updatelastjoin(regchanuser *rcup);
929 void csdb_updatetopic(regchan *rcp);
930 void csdb_updatechannel(regchan *rcp);
931 void csdb_updatechannelcounters(regchan *rcp);
932 void csdb_updatechanneltimestamp(regchan *rcp);
933 void csdb_createchannel(regchan *rcp);
934 void csdb_deletechannel(regchan *rcp);
935 void csdb_deleteuser(reguser *rup);
936 void csdb_updateuser(reguser *rup);
937 void csdb_createuser(reguser *rup);
938 void csdb_updatechanuser(regchanuser *rcup);
939 void csdb_createchanuser(regchanuser *rcup);
940 void csdb_deletechanuser(regchanuser *rcup);
941 void csdb_createban(regchan *rcp, regban *rbp);
942 void csdb_deleteban(regban *rbp);
943 void csdb_createmail(reguser *rup, int type);
944 void csdb_deletemaildomain(maildomain *mdp);
945 void csdb_createmaildomain(maildomain *mdp);
946 void csdb_updatemaildomain(maildomain *mdp);
947 void csdb_chanlevhistory_insert(regchan *rcp, nick *np, reguser *trup, flag_t oldflags, flag_t newflags);
948 void csdb_accounthistory_insert(nick *np, char *oldpass, char *newpass, sstring *oldemail, sstring *newemail);
949 void csdb_cleanuphistories();
950
951
952 #endif