]> jfr.im git - solanum.git/blame - extensions/extb_channel.c
librb: define RB_PATH_SEPARATOR
[solanum.git] / extensions / extb_channel.c
CommitLineData
212380e3
AC
1/*
2 * Channel extban type: matches users who are in a certain public channel
3 * -- jilles
212380e3
AC
4 */
5
6#include "stdinc.h"
7#include "modules.h"
8#include "client.h"
9#include "channel.h"
10#include "hash.h"
11#include "ircd.h"
12
eeabf33a
EM
13static const char extb_desc[] = "Channel ($c) extban type";
14
212380e3
AC
15static int _modinit(void);
16static void _moddeinit(void);
17static int eb_channel(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
18
c81afd15 19DECLARE_MODULE_AV2(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
212380e3
AC
20
21static int
22_modinit(void)
23{
24 extban_table['c'] = eb_channel;
25
26 return 0;
27}
28
29static void
30_moddeinit(void)
31{
32 extban_table['c'] = NULL;
33}
34
35static 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 */
3bfac098 51 if (!PubChannel(chptr2) && chptr2 != chptr)
212380e3
AC
52 return EXTBAN_INVALID;
53 return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
54}