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