]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * Canjoin extban type: matches users who are or are not banned from a | |
3 | * specified channel. | |
4 | * -- nenolod/jilles | |
212380e3 AC |
5 | */ |
6 | ||
7 | #include "stdinc.h" | |
8 | #include "modules.h" | |
9 | #include "client.h" | |
10 | #include "channel.h" | |
11 | #include "hash.h" | |
12 | #include "ircd.h" | |
13 | ||
14 | static int _modinit(void); | |
15 | static void _moddeinit(void); | |
16 | static int eb_canjoin(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); | |
17 | ||
18 | DECLARE_MODULE_AV1(extb_canjoin, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1841 $"); | |
19 | ||
20 | static int | |
21 | _modinit(void) | |
22 | { | |
23 | extban_table['j'] = eb_canjoin; | |
24 | ||
25 | return 0; | |
26 | } | |
27 | ||
28 | static void | |
29 | _moddeinit(void) | |
30 | { | |
31 | extban_table['j'] = NULL; | |
32 | } | |
33 | ||
34 | static int eb_canjoin(const char *data, struct Client *client_p, | |
35 | struct Channel *chptr, long mode_type) | |
36 | { | |
37 | struct Channel *chptr2; | |
38 | int ret; | |
39 | static int recurse = 0; | |
40 | ||
41 | (void)mode_type; | |
42 | /* don't process a $j in a $j'ed list */ | |
43 | if (recurse) | |
44 | return EXTBAN_INVALID; | |
45 | if (data == NULL) | |
46 | return EXTBAN_INVALID; | |
47 | chptr2 = find_channel(data); | |
48 | /* must exist, and no point doing this with the same channel */ | |
49 | if (chptr2 == NULL || chptr2 == chptr) | |
50 | return EXTBAN_INVALID; | |
51 | /* require consistent target */ | |
52 | if (chptr->chname[0] == '#' && data[0] == '&') | |
53 | return EXTBAN_INVALID; | |
54 | /* this allows getting some information about ban exceptions | |
55 | * but +s/+p doesn't seem the right criterion */ | |
56 | #if 0 | |
57 | /* privacy! don't allow +s/+p channels to influence another channel */ | |
58 | if (!PubChannel(chptr2)) | |
59 | return EXTBAN_INVALID; | |
60 | #endif | |
61 | recurse = 1; | |
765d839d | 62 | ret = is_banned(chptr2, client_p, NULL, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH; |
212380e3 AC |
63 | recurse = 0; |
64 | return ret; | |
65 | } |