]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/extb_channel.c
Add description for LOCOPS message.
[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 * $Id: extb_channel.c 1723 2006-07-06 15:23:58Z jilles $
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_channel(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
18
19 DECLARE_MODULE_AV1(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1723 $");
20
21 static int
22 _modinit(void)
23 {
24 extban_table['c'] = eb_channel;
25
26 return 0;
27 }
28
29 static void
30 _moddeinit(void)
31 {
32 extban_table['c'] = NULL;
33 }
34
35 static int eb_channel(const char *data, struct Client *client_p,
36 struct Channel *chptr, long mode_type)
37 {
38 struct Channel *chptr2;
39
40 (void)chptr;
41 (void)mode_type;
42 if (data == NULL)
43 return EXTBAN_INVALID;
44 chptr2 = find_channel(data);
45 if (chptr2 == NULL)
46 return EXTBAN_INVALID;
47 /* require consistent target */
48 if (chptr->chname[0] == '#' && data[0] == '&')
49 return EXTBAN_INVALID;
50 /* privacy! don't allow +s/+p channels to influence another channel */
51 if (!PubChannel(chptr2))
52 return EXTBAN_INVALID;
53 return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
54 }