Add extban target for matching against a user's modes.
Syntax: $m:+o (require usermode +o) Syntax: $m:+o-a (require usermode +o but do not allow +a) Syntax: $m:+a (require usermode +a) Syntax: $m:-h (require user disables cloaking to enter)
This commit is contained in:
parent
97532cfafb
commit
0b18e32cad
2 changed files with 78 additions and 0 deletions
|
@ -42,6 +42,7 @@ SRCS = \
|
||||||
extb_server.c \
|
extb_server.c \
|
||||||
extb_ssl.c \
|
extb_ssl.c \
|
||||||
extb_realname.c \
|
extb_realname.c \
|
||||||
|
extb_usermode.c \
|
||||||
extb_extgecos.c \
|
extb_extgecos.c \
|
||||||
force_user_invis.c \
|
force_user_invis.c \
|
||||||
hurt.c \
|
hurt.c \
|
||||||
|
|
77
extensions/extb_usermode.c
Normal file
77
extensions/extb_usermode.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Usermode extban type: bans all users with a specific usermode
|
||||||
|
* -- nenolod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdinc.h"
|
||||||
|
#include "modules.h"
|
||||||
|
#include "hook.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "ircd.h"
|
||||||
|
#include "send.h"
|
||||||
|
#include "hash.h"
|
||||||
|
#include "s_conf.h"
|
||||||
|
#include "s_user.h"
|
||||||
|
#include "s_serv.h"
|
||||||
|
#include "numeric.h"
|
||||||
|
|
||||||
|
static int _modinit(void);
|
||||||
|
static void _moddeinit(void);
|
||||||
|
static int eb_usermode(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
|
||||||
|
|
||||||
|
DECLARE_MODULE_AV1(extb_account, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1299 $");
|
||||||
|
|
||||||
|
static int
|
||||||
|
_modinit(void)
|
||||||
|
{
|
||||||
|
extban_table['m'] = eb_usermode;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_moddeinit(void)
|
||||||
|
{
|
||||||
|
extban_table['m'] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int eb_usermode(const char *data, struct Client *client_p,
|
||||||
|
struct Channel *chptr, long mode_type)
|
||||||
|
{
|
||||||
|
int dir = MODE_ADD;
|
||||||
|
unsigned int modes_ack = 0, modes_nak = 0;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
(void)chptr;
|
||||||
|
|
||||||
|
/* $m must have a specified mode */
|
||||||
|
if (data == NULL)
|
||||||
|
return EXTBAN_NOMATCH;
|
||||||
|
|
||||||
|
for (p = data; *p != '\0'; p++)
|
||||||
|
{
|
||||||
|
switch (*p)
|
||||||
|
{
|
||||||
|
case '+':
|
||||||
|
dir = MODE_ADD;
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
dir = MODE_DEL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
switch (dir)
|
||||||
|
{
|
||||||
|
case MODE_DEL:
|
||||||
|
modes_nak |= user_modes[(unsigned char) *p];
|
||||||
|
break;
|
||||||
|
case MODE_ADD:
|
||||||
|
default:
|
||||||
|
modes_ack |= user_modes[(unsigned char) *p];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((client_p->umodes & modes_ack) && !(client_p->umodes & modes_nak)) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
|
||||||
|
}
|
Loading…
Reference in a new issue