2007-01-24 22:40:21 -08:00
|
|
|
/*
|
|
|
|
* Channel extban type: matches users who are in a certain public channel
|
|
|
|
* -- jilles
|
|
|
|
*/
|
|
|
|
|
2016-08-17 22:33:38 -07:00
|
|
|
namespace mode = ircd::chan::mode;
|
2016-08-16 20:01:20 -07:00
|
|
|
namespace ext = mode::ext;
|
2016-08-12 20:05:54 -07:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 01:29:41 -06:00
|
|
|
static const char extb_desc[] = "Channel ($c) extban type";
|
|
|
|
|
2007-01-24 22:40:21 -08:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2016-08-21 18:57:43 -07:00
|
|
|
static int eb_channel(const char *data, client::client *client_p, chan::chan *chptr, mode::type type);
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2016-03-07 00:31:41 -06:00
|
|
|
DECLARE_MODULE_AV2(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
2007-01-24 22:40:21 -08:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
2016-08-16 20:01:20 -07:00
|
|
|
ext::table['c'] = eb_channel;
|
2007-01-24 22:40:21 -08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2016-08-16 20:01:20 -07:00
|
|
|
ext::table['c'] = NULL;
|
2007-01-24 22:40:21 -08:00
|
|
|
}
|
|
|
|
|
2016-08-21 18:57:43 -07:00
|
|
|
static int eb_channel(const char *data, client::client *client_p,
|
2016-08-17 22:33:38 -07:00
|
|
|
chan::chan *chptr, mode::type type)
|
2007-01-24 22:40:21 -08:00
|
|
|
{
|
2016-08-16 20:01:20 -07:00
|
|
|
using namespace ext;
|
|
|
|
|
2016-08-17 22:33:38 -07:00
|
|
|
chan::chan *chptr2;
|
2007-01-24 22:40:21 -08:00
|
|
|
|
|
|
|
(void)chptr;
|
2016-08-16 20:01:20 -07:00
|
|
|
|
2007-01-24 22:40:21 -08:00
|
|
|
if (data == NULL)
|
2016-08-16 20:01:20 -07:00
|
|
|
return INVALID;
|
2016-08-17 22:33:38 -07:00
|
|
|
|
2016-08-19 19:51:37 -07:00
|
|
|
chptr2 = chan::get(data, std::nothrow);
|
2007-01-24 22:40:21 -08:00
|
|
|
if (chptr2 == NULL)
|
2016-08-16 20:01:20 -07:00
|
|
|
return INVALID;
|
2007-01-24 22:40:21 -08:00
|
|
|
/* require consistent target */
|
2016-08-17 22:33:38 -07:00
|
|
|
if (chptr->name[0] == '#' && data[0] == '&')
|
2016-08-16 20:01:20 -07:00
|
|
|
return INVALID;
|
2007-01-24 22:40:21 -08:00
|
|
|
/* privacy! don't allow +s/+p channels to influence another channel */
|
2016-08-18 16:33:46 -07:00
|
|
|
if (!is_public(chptr2) && chptr2 != chptr)
|
2016-08-16 20:01:20 -07:00
|
|
|
return INVALID;
|
2016-08-17 22:33:38 -07:00
|
|
|
|
|
|
|
return is_member(chptr2, client_p)? MATCH : NOMATCH;
|
2007-01-24 22:40:21 -08:00
|
|
|
}
|