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