2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Extended extban type: bans all users with matching nick!user@host#gecos.
|
|
|
|
* Requested by Lockwood.
|
|
|
|
* - nenolod
|
|
|
|
*/
|
|
|
|
|
2016-08-18 07:33:38 +02:00
|
|
|
namespace mode = ircd::chan::mode;
|
2016-08-17 05:01:20 +02:00
|
|
|
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[] = "Extended mask ($x) extban type";
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2016-08-22 03:57:43 +02:00
|
|
|
static int eb_extended(const char *data, client::client *client_p, chan::chan *chptr, mode::type);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
DECLARE_MODULE_AV2(extb_extended, _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['x'] = eb_extended;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
ext::table['x'] = NULL;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-22 03:57:43 +02:00
|
|
|
static int eb_extended(const char *data, client::client *client_p,
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *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
|
|
|
char buf[BUFSIZE];
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
(void)chptr;
|
|
|
|
|
|
|
|
if (data == NULL)
|
2016-08-17 05:01:20 +02:00
|
|
|
return INVALID;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-02-10 02:25:32 +01:00
|
|
|
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
|
2007-01-25 07:40:21 +01:00
|
|
|
client_p->name, client_p->username, client_p->host, client_p->info);
|
|
|
|
|
2016-08-17 05:01:20 +02:00
|
|
|
ret = match(data, buf) ? MATCH : NOMATCH;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
if (ret == NOMATCH && is_dyn_spoof(*client_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-02-10 02:25:32 +01:00
|
|
|
snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
|
2007-01-25 07:40:21 +01:00
|
|
|
client_p->name, client_p->username, client_p->orighost, client_p->info);
|
|
|
|
|
2016-08-17 05:01:20 +02:00
|
|
|
ret = match(data, buf) ? MATCH : NOMATCH;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|