]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/extb_channel.c
Removal of ancient SVN ID's part one
[irc/rqf/shadowircd.git] / extensions / extb_channel.c
1 /*
2 * Channel extban type: matches users who are in a certain public channel
3 * -- jilles
4 *
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_channel(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
17
18 DECLARE_MODULE_AV1(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1723 $");
19
20 static int
21 _modinit(void)
22 {
23 extban_table['c'] = eb_channel;
24
25 return 0;
26 }
27
28 static void
29 _moddeinit(void)
30 {
31 extban_table['c'] = NULL;
32 }
33
34 static int eb_channel(const char *data, struct Client *client_p,
35 struct Channel *chptr, long mode_type)
36 {
37 struct Channel *chptr2;
38
39 (void)chptr;
40 (void)mode_type;
41 if (data == NULL)
42 return EXTBAN_INVALID;
43 chptr2 = find_channel(data);
44 if (chptr2 == NULL)
45 return EXTBAN_INVALID;
46 /* require consistent target */
47 if (chptr->chname[0] == '#' && data[0] == '&')
48 return EXTBAN_INVALID;
49 /* privacy! don't allow +s/+p channels to influence another channel */
50 if (!PubChannel(chptr2))
51 return EXTBAN_INVALID;
52 return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
53 }