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