2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Channel extban type: matches users who are in a certain public channel
|
|
|
|
* -- jilles
|
|
|
|
*/
|
|
|
|
|
2016-08-17 05:01:20 +02:00
|
|
|
namespace chan = ircd::chan;
|
|
|
|
namespace mode = chan::mode;
|
|
|
|
namespace ext = mode::ext;
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char extb_desc[] = "Channel ($c) extban type";
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2016-08-17 05:01:20 +02:00
|
|
|
static int eb_channel(const char *data, struct Client *client_p, struct Channel *chptr, mode::type type);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
DECLARE_MODULE_AV2(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
ext::table['c'] = eb_channel;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
ext::table['c'] = NULL;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int eb_channel(const char *data, struct Client *client_p,
|
2016-08-17 05:01:20 +02:00
|
|
|
struct Channel *chptr, mode::type type)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
using namespace ext;
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
struct Channel *chptr2;
|
|
|
|
|
|
|
|
(void)chptr;
|
2016-08-17 05:01:20 +02:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if (data == NULL)
|
2016-08-17 05:01:20 +02:00
|
|
|
return INVALID;
|
2007-01-25 07:40:21 +01:00
|
|
|
chptr2 = find_channel(data);
|
|
|
|
if (chptr2 == NULL)
|
2016-08-17 05:01:20 +02:00
|
|
|
return INVALID;
|
2007-01-25 07:40:21 +01:00
|
|
|
/* require consistent target */
|
|
|
|
if (chptr->chname[0] == '#' && data[0] == '&')
|
2016-08-17 05:01:20 +02:00
|
|
|
return INVALID;
|
2007-01-25 07:40:21 +01:00
|
|
|
/* privacy! don't allow +s/+p channels to influence another channel */
|
2014-06-21 21:48:37 +02:00
|
|
|
if (!PubChannel(chptr2) && chptr2 != chptr)
|
2016-08-17 05:01:20 +02:00
|
|
|
return INVALID;
|
|
|
|
return IsMember(client_p, chptr2) ? MATCH : NOMATCH;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|