]>
jfr.im git - solanum.git/blob - extensions/extb_usermode.c
2 * Usermode extban type: bans all users with a specific usermode
18 static int _modinit(void);
19 static void _moddeinit(void);
20 static int eb_usermode(const char *data
, struct Client
*client_p
, struct Channel
*chptr
, long mode_type
);
21 static const char extb_desc
[] = "Usermode ($m) extban type";
23 DECLARE_MODULE_AV2(extb_usermode
, _modinit
, _moddeinit
, NULL
, NULL
, NULL
, NULL
, NULL
, extb_desc
);
28 extban_table
['m'] = eb_usermode
;
36 extban_table
['m'] = NULL
;
39 static int eb_usermode(const char *data
, struct Client
*client_p
,
40 struct Channel
*chptr
, long mode_type
)
43 unsigned int modes_ack
= 0, modes_nak
= 0;
48 /* $m must have a specified mode */
50 return EXTBAN_INVALID
;
52 for (p
= data
; *p
!= '\0'; p
++)
66 modes_nak
|= user_modes
[(unsigned char) *p
];
70 modes_ack
|= user_modes
[(unsigned char) *p
];
77 return ((client_p
->umodes
& modes_ack
) == modes_ack
&&
78 !(client_p
->umodes
& modes_nak
)) ?
79 EXTBAN_MATCH
: EXTBAN_NOMATCH
;