2007-01-25 06:40:21 +00:00
|
|
|
/*
|
|
|
|
* Extended extban type: bans all users with matching nick!user@host#gecos.
|
|
|
|
* Requested by Lockwood.
|
|
|
|
* - nenolod
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
|
2016-03-09 07:29:41 +00:00
|
|
|
static const char extb_desc[] = "Extended mask ($x) extban type";
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
|
|
|
static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
|
|
|
|
|
2016-03-07 06:31:41 +00:00
|
|
|
DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
|
|
|
extban_table['x'] = eb_extended;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
|
|
|
extban_table['x'] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int eb_extended(const char *data, struct Client *client_p,
|
|
|
|
struct Channel *chptr, long mode_type)
|
|
|
|
{
|
|
|
|
(void)chptr;
|
|
|
|
|
|
|
|
if (data == NULL)
|
|
|
|
return EXTBAN_INVALID;
|
|
|
|
|
2023-07-01 18:16:27 +00:00
|
|
|
const char *idx = strchr(data, '#');
|
|
|
|
|
|
|
|
if (idx != NULL && idx[1] == '\0')
|
|
|
|
/* Users cannot have empty realnames,
|
|
|
|
* so don't let a ban be set matching one
|
|
|
|
*/
|
|
|
|
return EXTBAN_INVALID;
|
|
|
|
|
|
|
|
if (idx != NULL)
|
|
|
|
{
|
|
|
|
char buf[BUFSIZE];
|
|
|
|
|
|
|
|
// Copy the nick!user@host part of the ban
|
|
|
|
memcpy(buf, data, (idx - data));
|
|
|
|
buf[(idx - data)] = '\0';
|
|
|
|
|
|
|
|
// Advance to the realname part of the ban
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
if (client_matches_mask(client_p, buf) && match(idx, client_p->info))
|
|
|
|
return EXTBAN_MATCH;
|
|
|
|
|
|
|
|
return EXTBAN_NOMATCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client_matches_mask(client_p, data))
|
|
|
|
return EXTBAN_MATCH;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2023-07-01 18:16:27 +00:00
|
|
|
return EXTBAN_NOMATCH;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|