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