]>
Commit | Line | Data |
---|---|---|
d76ed9a9 AS |
1 | /* hash.h - IRC network state database |
2 | * Copyright 2000-2004 srvx Development Team | |
3 | * | |
83ff05c3 | 4 | * This file is part of x3. |
d76ed9a9 | 5 | * |
d0f04f71 | 6 | * x3 is free software; you can redistribute it and/or modify |
d76ed9a9 | 7 | * it under the terms of the GNU General Public License as published by |
348683aa | 8 | * the Free Software Foundation; either version 3 of the License, or |
d76ed9a9 AS |
9 | * (at your option) any later version. |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with srvx; if not, write to the Free Software Foundation, | |
18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
19 | */ | |
20 | ||
21 | #ifndef HASH_H | |
22 | #define HASH_H | |
23 | ||
24 | #include "common.h" | |
25 | #include "dict.h" | |
26 | #include "policer.h" | |
df7819d9 | 27 | #include "recdb.h" |
d76ed9a9 | 28 | |
d0cb2fb6 AS |
29 | #define MODE_CHANOP 0x00000001 /* +o USER */ |
30 | #define MODE_VOICE 0x00000002 /* +v USER */ | |
31 | #define MODE_PRIVATE 0x00000004 /* +p */ | |
32 | #define MODE_SECRET 0x00000008 /* +s */ | |
33 | #define MODE_MODERATED 0x00000010 /* +m */ | |
34 | #define MODE_TOPICLIMIT 0x00000020 /* +t */ | |
35 | #define MODE_INVITEONLY 0x00000040 /* +i */ | |
36 | #define MODE_NOPRIVMSGS 0x00000080 /* +n */ | |
37 | #define MODE_KEY 0x00000100 /* +k KEY */ | |
38 | #define MODE_BAN 0x00000200 /* +b BAN */ | |
39 | #define MODE_LIMIT 0x00000400 /* +l LIMIT */ | |
40 | #define MODE_DELAYJOINS 0x00000800 /* +D */ | |
7827220c | 41 | #define MODE_REGONLY 0x00001000 /* ircu +r */ |
d0cb2fb6 AS |
42 | #define MODE_NOCOLORS 0x00002000 /* +c */ |
43 | #define MODE_NOCTCPS 0x00004000 /* +C */ | |
44 | #define MODE_REGISTERED 0x00008000 /* Bahamut +r */ | |
45 | #define MODE_STRIPCOLOR 0x00010000 /* +S Strip mirc color codes */ | |
46 | #define MODE_MODUNREG 0x00020000 /* +M mod unregister */ | |
47 | #define MODE_NONOTICE 0x00040000 /* +N no notices */ | |
48 | #define MODE_OPERSONLY 0x00080000 /* +O Opers only */ | |
49 | #define MODE_NOQUITMSGS 0x00100000 /* +Q suppress messages from quit notices */ | |
50 | #define MODE_NOAMSG 0x00200000 /* +T no multi-target messages */ | |
c8ca69a0 | 51 | #define MODE_SSLONLY 0x00400000 /* +Z ssl only */ |
55342ce8 | 52 | #define MODE_HALFOP 0x00800000 /* +h USER */ |
2aef5f4b | 53 | #define MODE_EXEMPT 0x01000000 /* +e exempt */ |
88c7cb10 | 54 | #define MODE_HIDEMODE 0x02000000 /* +L hide modes */ |
2f61d1d7 | 55 | #define MODE_APASS 0x04000000 /* +A adminpass */ |
56 | #define MODE_UPASS 0x08000000 /* +U userpass */ | |
4648ded2 | 57 | #define MODE_ADMINSONLY 0x10000000 /* +a Admins only */ |
d76ed9a9 AS |
58 | #define MODE_REMOVE 0x80000000 |
59 | ||
8d882965 MB |
60 | #define FLAGS_OPER 0x00000001 /* Operator +o */ |
61 | #define FLAGS_LOCOP 0x00000002 /* Local operator +O */ | |
62 | #define FLAGS_INVISIBLE 0x00000004 /* invisible +i */ | |
63 | #define FLAGS_WALLOP 0x00000008 /* receives wallops +w */ | |
64 | #define FLAGS_DUMMY 0x00000010 /* user is not announced to other servers */ | |
65 | #define FLAGS_DEAF 0x00000020 /* deaf +d */ | |
66 | #define FLAGS_SERVICE 0x00000040 /* cannot be kicked, killed or deoped +k */ | |
67 | #define FLAGS_GLOBAL 0x00000080 /* receives global messages +g */ | |
68 | #define FLAGS_SETHOST 0x00000100 /* sethost +h */ | |
69 | #define FLAGS_PERSISTENT 0x00000200 /* for reserved nicks, this isn't just one-shot */ | |
70 | #define FLAGS_GAGGED 0x00000400 /* for gagged users */ | |
71 | #define FLAGS_AWAY 0x00000800 /* for away users */ | |
72 | #define FLAGS_STAMPED 0x00001000 /* for users who have been stamped */ | |
73 | #define FLAGS_HIDDEN_HOST 0x00002000 /* user's host is masked by their account +x */ | |
74 | #define FLAGS_REGNICK 0x00004000 /* user owns their current nick */ | |
75 | #define FLAGS_REGISTERING 0x00008000 /* user has issued account register command, is waiting for email cookie */ | |
76 | #define FLAGS_BOT 0x00010000 /* Bot +B */ | |
77 | #define FLAGS_HIDECHANS 0x00020000 /* Hidden channels +n */ | |
78 | #define FLAGS_HIDEIDLE 0x00040000 /* Hidden idle time +I */ | |
79 | #define FLAGS_XTRAOP 0x00080000 /* user is XtraOP +X */ | |
80 | #define FLAGS_CLOAKHOST 0x00100000 /* user has cloaked host +C */ | |
81 | #define FLAGS_CLOAKIP 0x00200000 /* user has cloaked ip +c */ | |
82 | #define FLAGS_ADMIN 0x00400000 /* Admin +a */ | |
83 | #define FLAGS_SSL 0x00800000 /* user is using a secure connection +z */ | |
84 | #define FLAGS_PRIVDEAF 0x01000000 /* user is deaf to private messages +D */ | |
85 | #define FLAGS_ACCOUNTONLY 0x02000000 /* user only receives PMs from authed users +R */ | |
86 | #define FLAGS_WHOIS 0x04000000 /* user receives notices when /whois'ed +W */ | |
87 | #define FLAGS_HIDEOPER 0x08000000 /* user is a hidden IRCop +H */ | |
88 | #define FLAGS_NOLINK 0x10000000 /* user has opted out of channel redirection +L */ | |
89 | #define FLAGS_COMMONCHANSONLY 0x20000000 /* user only receives PMs from users on same cahnnels +q */ | |
d76ed9a9 AS |
90 | |
91 | #define IsOper(x) ((x)->modes & FLAGS_OPER) | |
92 | #define IsService(x) ((x)->modes & FLAGS_SERVICE) | |
93 | #define IsDeaf(x) ((x)->modes & FLAGS_DEAF) | |
94 | #define IsInvisible(x) ((x)->modes & FLAGS_INVISIBLE) | |
95 | #define IsGlobal(x) ((x)->modes & FLAGS_GLOBAL) | |
96 | #define IsWallOp(x) ((x)->modes & FLAGS_WALLOP) | |
cf8bedff | 97 | #define IsBotM(x) ((x)->modes & FLAGS_BOT) |
98 | #define IsHideChans(x) ((x)->modes & FLAGS_HIDECHANS) | |
99 | #define IsHideIdle(x) ((x)->modes & FLAGS_HIDEIDLE) | |
100 | #define IsXtraOp(x) ((x)->modes & FLAGS_XTRAOP) | |
182dd032 | 101 | #define IsSetHost(x) ((x)->modes & FLAGS_SETHOST) |
d76ed9a9 AS |
102 | #define IsGagged(x) ((x)->modes & FLAGS_GAGGED) |
103 | #define IsPersistent(x) ((x)->modes & FLAGS_PERSISTENT) | |
104 | #define IsAway(x) ((x)->modes & FLAGS_AWAY) | |
105 | #define IsStamped(x) ((x)->modes & FLAGS_STAMPED) | |
106 | #define IsHiddenHost(x) ((x)->modes & FLAGS_HIDDEN_HOST) | |
107 | #define IsReggedNick(x) ((x)->modes & FLAGS_REGNICK) | |
108 | #define IsRegistering(x) ((x)->modes & FLAGS_REGISTERING) | |
1136f709 | 109 | #define IsDummy(x) ((x)->modes & FLAGS_DUMMY) |
d76ed9a9 AS |
110 | #define IsFakeHost(x) ((x)->fakehost[0] != '\0') |
111 | #define IsLocal(x) ((x)->uplink == self) | |
fc55e757 MB |
112 | #define IsAdmin(x) ((x)->modes & FLAGS_ADMIN) |
113 | #define IsSSL(x) ((x)->modes & FLAGS_SSL) | |
8d882965 MB |
114 | #define IsPrivDeaf(x) ((x)->modes & FLAGS_PRIVDEAF) |
115 | #define IsAccountOnly(x) ((x)->modes & FLAGS_ACCOUNTONLY) | |
116 | #define IsWhoisNotice(x) ((x)->modes & FLAGS_WHOIS) | |
117 | #define IsHideOper(x) ((x)->modes & FLAGS_HIDEOPER) | |
118 | #define IsNoRedirect(x) ((x)->modes & FLAGS_NOLINK) | |
119 | #define IsCommonChansOnly(x) ((x)->modes & FLAGS_COMMONCHANSONLY) | |
d76ed9a9 AS |
120 | |
121 | #define NICKLEN 30 | |
122 | #define USERLEN 10 | |
bdddfe43 | 123 | #define HOSTLEN 75 |
68b75482 | 124 | #define SOCKIPLEN 45 |
258d1427 | 125 | #define ACCOUNTLEN 15 |
d76ed9a9 AS |
126 | #define REALLEN 50 |
127 | #define TOPICLEN 250 | |
128 | #define CHANNELLEN 200 | |
6d58d26f | 129 | #define MARKLEN 200 |
2f61d1d7 | 130 | #define MAXOPLEVEL 999 |
d76ed9a9 AS |
131 | |
132 | #define MAXMODEPARAMS 6 | |
ac3bdc8d | 133 | #define MAXBANS 128 |
2aef5f4b | 134 | #define MAXEXEMPTS 45 |
d76ed9a9 AS |
135 | |
136 | /* IDLEN is 6 because it takes 5.33 Base64 digits to store 32 bytes. */ | |
137 | #define IDLEN 6 | |
138 | ||
89d871d8 | 139 | /** Operator privileges. */ |
140 | enum Priv { | |
141 | PRIV_CHAN_LIMIT, /**< no channel limit on oper */ | |
142 | PRIV_MODE_LCHAN, /**< oper can mode local chans */ | |
143 | PRIV_WALK_LCHAN, /**< oper can walk through local modes */ | |
144 | PRIV_DEOP_LCHAN, /**< no deop oper on local chans */ | |
145 | PRIV_SHOW_INVIS, /**< show local invisible users */ | |
146 | PRIV_SHOW_ALL_INVIS, /**< show all invisible users */ | |
147 | PRIV_UNLIMIT_QUERY, /**< unlimit who queries */ | |
148 | PRIV_KILL, /**< oper can KILL */ | |
149 | PRIV_LOCAL_KILL, /**< oper can local KILL */ | |
150 | PRIV_REHASH, /**< oper can REHASH */ | |
151 | PRIV_REMOTEREHASH, /**< oper can remote REHASH */ | |
152 | PRIV_RESTART, /**< oper can RESTART */ | |
153 | PRIV_DIE, /**< oper can DIE */ | |
625ccd4e MB |
154 | PRIV_ZLINE, /**< oper can ZLINE */ |
155 | PRIV_LOCAL_ZLINE, /**< oper can local ZLINE */ | |
89d871d8 | 156 | PRIV_GLINE, /**< oper can GLINE */ |
157 | PRIV_LOCAL_GLINE, /**< oper can local GLINE */ | |
158 | PRIV_SHUN, /**< oper can SHUN */ | |
159 | PRIV_LOCAL_SHUN, /**< oper can local SHUN */ | |
160 | PRIV_JUPE, /**< oper can JUPE */ | |
161 | PRIV_LOCAL_JUPE, /**< oper can local JUPE */ | |
162 | PRIV_OPMODE, /**< oper can OP/CLEARMODE */ | |
163 | PRIV_LOCAL_OPMODE, /**< oper can local OP/CLEARMODE */ | |
164 | PRIV_SET, /**< oper can SET */ | |
165 | PRIV_WHOX, /**< oper can use /who x */ | |
166 | PRIV_BADCHAN, /**< oper can BADCHAN */ | |
167 | PRIV_LOCAL_BADCHAN, /**< oper can local BADCHAN */ | |
168 | PRIV_SEE_CHAN, /**< oper can see in secret chans */ | |
169 | PRIV_PROPAGATE, /**< propagate oper status */ | |
170 | PRIV_DISPLAY, /**< "Is an oper" displayed */ | |
c9aeceb5 | 171 | PRIV_DISPLAY_MODE, /**< oper can set +H hide oper */ |
89d871d8 | 172 | PRIV_SEE_OPERS, /**< display hidden opers */ |
173 | PRIV_WIDE_GLINE, /**< oper can set wider G-lines */ | |
625ccd4e | 174 | PRIV_WIDE_ZLINE, /**< oper can set wider Z-Lines */ |
89d871d8 | 175 | PRIV_WIDE_SHUN, /**< oper can set wider G-lines */ |
176 | PRIV_LIST_CHAN, /**< oper can list secret channels */ | |
177 | PRIV_FORCE_OPMODE, /**< can hack modes on quarantined channels */ | |
178 | PRIV_FORCE_LOCAL_OPMODE, /**< can hack modes on quarantined local channels */ | |
179 | PRIV_CHECK, /**< oper can use CHECK */ | |
180 | PRIV_SEE_SECRET_CHAN, /**< oper can see +s channels in whois */ | |
055f3f30 MB |
181 | PRIV_WHOIS_NOTICE, /**< oper can set/unset user mode +W */ |
182 | PRIV_HIDE_IDLE, /**< oper can set/unset user mode +I */ | |
183 | PRIV_XTRAOP, /**< oper can set/unset user mode +X */ | |
184 | PRIV_HIDE_CHANNELS, /**< oper can set/unset user mode +n */ | |
c9aeceb5 | 185 | PRIV_FREEFORM, /**< oper can set any host on themseves using set host |
186 | as long as its a valid host */ | |
187 | PRIV_REMOVE, /**< oper can force remove deactivated glines, | |
188 | shuns and zlines. */ | |
189 | PRIV_SPAMFILTER, /**< oper can set spamfilters via SPAMFILTER */ | |
57cd328b MB |
190 | PRIV_ADMIN, /**< oper is an IRC Admin */ |
191 | PRIV_APASS_OPMODE, /**< oper can use OPMODE to set/unset channel modes +A and +U */ | |
192 | PRIV_HIDE_OPER, /**< oper can set/unset user mode +H */ | |
193 | PRIV_REMOTE, /**< oper can use his/her operator block from a remote server */ | |
194 | PRIV_SERVICE, /**< oper can set/unset user mode +k */ | |
89d871d8 | 195 | PRIV_LAST_PRIV /**< number of privileges */ |
196 | }; | |
197 | ||
198 | /** Number of bits */ | |
199 | #define _PRIV_NBITS (8 * sizeof(unsigned long)) | |
200 | /** Element number for priv \a priv. */ | |
201 | #define _PRIV_IDX(priv) ((priv) / _PRIV_NBITS) | |
202 | /** Element bit for priv \a priv. */ | |
203 | #define _PRIV_BIT(priv) (1UL << ((priv) % _PRIV_NBITS)) | |
204 | ||
205 | /** Operator privileges. */ | |
206 | struct Privs { | |
207 | unsigned long priv_mask[(PRIV_LAST_PRIV + _PRIV_NBITS - 1) / _PRIV_NBITS]; | |
208 | }; | |
209 | ||
d76ed9a9 AS |
210 | DECLARE_LIST(userList, struct userNode*); |
211 | DECLARE_LIST(modeList, struct modeNode*); | |
212 | DECLARE_LIST(banList, struct banNode*); | |
2aef5f4b | 213 | DECLARE_LIST(exemptList, struct exemptNode*); |
d76ed9a9 AS |
214 | DECLARE_LIST(channelList, struct chanNode*); |
215 | DECLARE_LIST(serverList, struct server*); | |
216 | ||
217 | struct userNode { | |
218 | char *nick; /* Unique name of the client, nick or host */ | |
219 | char ident[USERLEN + 1]; /* Per-host identification for user */ | |
220 | char info[REALLEN + 1]; /* Free form additional client information */ | |
221 | char hostname[HOSTLEN + 1]; /* DNS name or IP address */ | |
222 | char fakehost[HOSTLEN + 1]; /* Assigned fake host */ | |
37ef8ee3 | 223 | char crypthost[HOSTLEN + 30]; /* Crypted hostname */ |
224 | char cryptip[SOCKIPLEN + 30]; /* Crypted IP */ | |
d76ed9a9 AS |
225 | #ifdef WITH_PROTOCOL_P10 |
226 | char numeric[COMBO_NUMERIC_LEN+1]; | |
227 | unsigned int num_local : 18; | |
228 | #endif | |
3fdd6a74 | 229 | unsigned int loc; /* Is user connecting via LOC? */ |
da5b7dfc | 230 | unsigned int no_notice; /* Does the users client not see notices? */ |
d76ed9a9 | 231 | unsigned int dead : 1; /* Is user waiting to be recycled? */ |
2f61d1d7 | 232 | irc_in_addr_t ip; /* User's IP address */ |
d76ed9a9 AS |
233 | long modes; /* user flags +isw etc... */ |
234 | ||
182dd032 AS |
235 | // sethost - reed/apples |
236 | char sethost[USERLEN + HOSTLEN + 2]; /* 1 for '\0' and 1 for @ = 2 */ | |
237 | ||
21f6caee | 238 | /* GeoIP Data */ |
239 | char *country_name; | |
240 | ||
241 | /* GeoIP City Data */ | |
242 | char *country_code; | |
243 | char *city; | |
244 | char *region; | |
245 | char *postal_code; | |
246 | float latitude; | |
247 | float longitude; | |
248 | int dma_code; | |
249 | int area_code; | |
250 | ||
2c00fbc2 | 251 | char *mark; /* only filled if they are marked */ |
0e08a8e0 | 252 | char *version_reply; /* only filled in if a version query was triggered */ |
ba4b4d51 | 253 | char *sslfp; /* only filled in if a mark SSLCLIFP is received */ |
21f6caee | 254 | |
df7819d9 MB |
255 | struct string_list *marks; /* list of user's marks */ |
256 | ||
d76ed9a9 | 257 | time_t timestamp; /* Time of last nick change */ |
1136f709 | 258 | time_t idle_since; |
d76ed9a9 AS |
259 | struct server *uplink; /* Server that user is connected to */ |
260 | struct modeList channels; /* Vector of channels user is in */ | |
89d871d8 | 261 | struct Privs privs; |
d76ed9a9 AS |
262 | |
263 | /* from nickserv */ | |
264 | struct handle_info *handle_info; | |
265 | struct userNode *next_authed; | |
266 | struct policer auth_policer; | |
267 | }; | |
268 | ||
89d871d8 | 269 | #define privs(cli) ((cli)->privs) |
270 | #define PrivSet(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] |= \ | |
271 | _PRIV_BIT(priv)) | |
272 | #define PrivClr(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] &= \ | |
273 | ~(_PRIV_BIT(priv))) | |
274 | #define PrivHas(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] & \ | |
275 | _PRIV_BIT(priv)) | |
276 | ||
277 | #define PRIV_ADD 1 | |
278 | #define PRIV_DEL 0 | |
279 | ||
280 | #define GrantPriv(cli, priv) (PrivSet(&(privs(cli)), priv)) | |
281 | #define RevokePriv(cli, priv) (PrivClr(&(privs(cli)), priv)) | |
282 | #define HasPriv(cli, priv) (PrivHas(&(privs(cli)), priv)) | |
283 | ||
d76ed9a9 AS |
284 | struct chanNode { |
285 | chan_mode_t modes; | |
286 | unsigned int limit, locks; | |
287 | char key[KEYLEN + 1]; | |
2f61d1d7 | 288 | char upass[KEYLEN + 1]; |
289 | char apass[KEYLEN + 1]; | |
d76ed9a9 AS |
290 | time_t timestamp; /* creation time */ |
291 | ||
292 | char topic[TOPICLEN + 1]; | |
293 | char topic_nick[NICKLEN + 1]; | |
294 | time_t topic_time; | |
295 | ||
296 | struct modeList members; | |
297 | struct banList banlist; | |
2aef5f4b | 298 | struct exemptList exemptlist; |
d76ed9a9 AS |
299 | struct policer join_policer; |
300 | unsigned int join_flooded : 1; | |
301 | unsigned int bad_channel : 1; | |
302 | ||
303 | struct chanData *channel_info; | |
304 | struct channel_help *channel_help; | |
305 | char name[1]; | |
306 | }; | |
307 | ||
308 | struct banNode { | |
309 | char ban[NICKLEN + USERLEN + HOSTLEN + 3]; /* 1 for '\0', 1 for ! and 1 for @ = 3 */ | |
310 | char who[NICKLEN + 1]; /* who set ban */ | |
311 | time_t set; /* time ban was set */ | |
312 | }; | |
313 | ||
2aef5f4b | 314 | struct exemptNode { |
315 | char exempt[NICKLEN + USERLEN + HOSTLEN + 3]; /* 1 for '\0', 1 for ! and 1 for @ = 3 */ | |
316 | char who[NICKLEN + 1]; /* who set exempt */ | |
317 | time_t set; /* time exempt was set */ | |
318 | }; | |
319 | ||
d76ed9a9 AS |
320 | struct modeNode { |
321 | struct chanNode *channel; | |
322 | struct userNode *user; | |
acf3c6d5 | 323 | long modes; |
2f61d1d7 | 324 | short oplevel; |
d76ed9a9 AS |
325 | time_t idle_since; |
326 | }; | |
327 | ||
328 | #define SERVERNAMEMAX 64 | |
329 | #define SERVERDESCRIPTMAX 128 | |
330 | ||
331 | struct server { | |
332 | char name[SERVERNAMEMAX+1]; | |
333 | time_t boot; | |
1136f709 | 334 | time_t link_time; |
d76ed9a9 AS |
335 | char description[SERVERDESCRIPTMAX+1]; |
336 | #ifdef WITH_PROTOCOL_P10 | |
337 | char numeric[COMBO_NUMERIC_LEN+1]; | |
338 | unsigned int num_mask; | |
339 | #endif | |
340 | unsigned int hops, clients, max_clients; | |
341 | unsigned int burst : 1, self_burst : 1; | |
342 | struct server *uplink; | |
343 | #ifdef WITH_PROTOCOL_P10 | |
344 | struct userNode **users; /* flat indexed by numeric */ | |
345 | #else | |
346 | dict_t users; /* indexed by nick */ | |
347 | #endif | |
348 | struct serverList children; | |
349 | }; | |
350 | ||
47956fc5 AS |
351 | struct waitingConnection { |
352 | char *server; | |
353 | char *target; | |
354 | }; | |
355 | ||
356 | struct routingPlan { | |
357 | dict_t servers; | |
358 | }; | |
359 | ||
360 | struct routingPlanServer { | |
361 | char *uplink; | |
362 | char *secondaryuplink; | |
363 | unsigned int port; | |
364 | int karma; | |
365 | int offline; | |
366 | }; | |
367 | ||
368 | /* Ported from X2 */ | |
369 | struct routeList { | |
370 | char* server; /* Name of the server */ | |
371 | unsigned int port; /* connection port */ | |
372 | char *uplink; /* Server its linked to (towards us) */ | |
373 | char *secondaryuplink; | |
374 | int outsideness; /* 0 means leaf, 1 second layer, etc. my uplink is highest */ | |
375 | struct routeList *next; | |
376 | }; | |
377 | ||
378 | /* Ported from X2 */ | |
379 | struct route { | |
380 | int count; /* how many servers we have */ | |
381 | int maxdepth; /* biggest outsideness value */ | |
382 | int centered; /* set to TRUE when changerouteUplinks is run */ | |
383 | struct routeList *servers; | |
384 | }; | |
385 | ||
386 | ||
d76ed9a9 AS |
387 | extern struct server *self; |
388 | extern dict_t channels; | |
389 | extern dict_t clients; | |
390 | extern dict_t servers; | |
391 | extern unsigned int max_clients, invis_clients; | |
392 | extern time_t max_clients_time; | |
393 | extern struct userList curr_opers, curr_helpers; | |
394 | ||
dc92ef7c MB |
395 | extern unsigned int count_opers; |
396 | ||
d76ed9a9 AS |
397 | struct server* GetServerH(const char *name); /* using full name */ |
398 | struct userNode* GetUserH(const char *nick); /* using nick */ | |
399 | struct chanNode* GetChannel(const char *name); | |
400 | struct modeNode* GetUserMode(struct chanNode* channel, struct userNode* user); | |
1136f709 | 401 | int userList_contains(struct userList *list, struct userNode *user); |
f1d4a7db | 402 | unsigned int IsUserP(struct userNode *user); |
d76ed9a9 | 403 | |
9d59f196 | 404 | typedef int (*server_link_func_t) (struct server *server, void *extra); |
405 | void reg_server_link_func(server_link_func_t handler, void *extra); | |
406 | void call_server_link_funcs(struct server *server); | |
d76ed9a9 | 407 | |
c8b4b87b MB |
408 | typedef void (*sasl_input_func_t) (struct server* source ,const char *identifier, const char *subcmd, const char *data, const char *ext, void *extra); |
409 | void reg_sasl_input_func(sasl_input_func_t handler, void *extra); | |
410 | void call_sasl_input_func(struct server* source ,const char *identifier, const char *subcmd, const char *data, const char *ext); | |
411 | void unreg_sasl_input_func(sasl_input_func_t handler, void *extra); | |
412 | ||
f0fb2e2d | 413 | typedef int (*new_user_func_t) (struct userNode *user, void *extra); |
414 | void reg_new_user_func(new_user_func_t handler, void *extra); | |
415 | void call_new_user_funcs(struct userNode *user); | |
a6bcc929 | 416 | typedef void (*del_user_func_t) (struct userNode *user, struct userNode *killer, const char *why, void *extra); |
417 | void reg_del_user_func(del_user_func_t handler, void *extra); | |
418 | void call_del_user_funcs(struct userNode *user, struct userNode *killer, const char *why); | |
419 | void unreg_del_user_func(del_user_func_t handler, void *extra); | |
d76ed9a9 | 420 | void ReintroduceUser(struct userNode* user); |
63189c10 | 421 | typedef void (*nick_change_func_t)(struct userNode *user, const char *old_nick, void *extra); |
422 | void reg_nick_change_func(nick_change_func_t handler, void *extra); | |
d76ed9a9 | 423 | void NickChange(struct userNode* user, const char *new_nick, int no_announce); |
cf8bedff | 424 | void SVSNickChange(struct userNode* user, const char *new_nick); |
d76ed9a9 AS |
425 | |
426 | typedef void (*account_func_t) (struct userNode *user, const char *stamp); | |
427 | void reg_account_func(account_func_t handler); | |
428 | void call_account_func(struct userNode *user, const char *stamp); | |
b21e2cfe | 429 | void StampUser(struct userNode *user, const char *stamp, time_t timestamp); |
d76ed9a9 | 430 | void assign_fakehost(struct userNode *user, const char *host, int announce); |
21f6caee | 431 | void set_geoip_info(struct userNode *user); |
d76ed9a9 | 432 | |
157ce145 | 433 | typedef void (*new_channel_func_t) (struct chanNode *chan, void *extra); |
434 | void reg_new_channel_func(new_channel_func_t handler, void *extra); | |
fb38e2bc | 435 | typedef int (*join_func_t) (struct modeNode *mNode, void *extra); |
436 | void reg_join_func(join_func_t handler, void *extra); | |
1898d8ea | 437 | typedef void (*del_channel_func_t) (struct chanNode *chan, void *extra); |
438 | void reg_del_channel_func(del_channel_func_t handler, void *extra); | |
d76ed9a9 | 439 | |
2aef5f4b | 440 | struct chanNode* AddChannel(const char *name, time_t time_, const char *modes, char *banlist, char *exemptlist); |
d76ed9a9 AS |
441 | void LockChannel(struct chanNode *channel); |
442 | void UnlockChannel(struct chanNode *channel); | |
443 | ||
444 | struct modeNode* AddChannelUser(struct userNode* user, struct chanNode* channel); | |
445 | ||
63637aea | 446 | typedef void (*part_func_t) (struct modeNode *mn, const char *reason, void *extra); |
447 | void reg_part_func(part_func_t handler, void *extra); | |
448 | void unreg_part_func(part_func_t handler, void *extra); | |
d76ed9a9 AS |
449 | void DelChannelUser(struct userNode* user, struct chanNode* channel, const char *reason, int deleting); |
450 | void KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why); | |
451 | ||
91667658 | 452 | typedef void (*kick_func_t) (struct userNode *kicker, struct userNode *user, struct chanNode *chan, void *extra); |
453 | void reg_kick_func(kick_func_t handler, void *extra); | |
d76ed9a9 AS |
454 | void ChannelUserKicked(struct userNode* kicker, struct userNode* victim, struct chanNode* channel); |
455 | ||
456 | int ChannelBanExists(struct chanNode *channel, const char *ban); | |
2aef5f4b | 457 | int ChannelExemptExists(struct chanNode *channel, const char *exempt); |
d76ed9a9 | 458 | |
5a2c7cf6 | 459 | typedef int (*topic_func_t)(struct userNode *who, struct chanNode *chan, const char *old_topic, void *extra); |
460 | void reg_topic_func(topic_func_t handler, void *extra); | |
7fda2b52 | 461 | void SetChannelTopic(struct chanNode *channel, struct userNode *service, struct userNode *user, const char *topic, int announce); |
ac3bdc8d | 462 | struct userNode *IsInChannel(struct chanNode *channel, struct userNode *user); |
d76ed9a9 AS |
463 | |
464 | void init_structs(void); | |
465 | ||
466 | #endif |