]>
jfr.im git - solanum.git/blob - extensions/extb_usermode.c
2 * Usermode extban type: bans all users with a specific usermode
18 static const char extb_desc
[] = "Usermode ($m) extban type";
20 static int _modinit(void);
21 static void _moddeinit(void);
22 static int eb_usermode(const char *data
, struct Client
*client_p
, struct Channel
*chptr
, long mode_type
);
24 DECLARE_MODULE_AV2(extb_usermode
, _modinit
, _moddeinit
, NULL
, NULL
, NULL
, NULL
, NULL
, extb_desc
);
29 extban_table
['u'] = eb_usermode
;
37 extban_table
['u'] = NULL
;
40 static int eb_usermode(const char *data
, struct Client
*client_p
,
41 struct Channel
*chptr
, long mode_type
)
44 unsigned int modes_ack
= 0, modes_nak
= 0;
49 /* $m must have a specified mode */
51 return EXTBAN_INVALID
;
53 for (p
= data
; *p
!= '\0'; p
++)
67 modes_nak
|= user_modes
[(unsigned char) *p
];
71 modes_ack
|= user_modes
[(unsigned char) *p
];
78 return ((client_p
->umodes
& modes_ack
) == modes_ack
&&
79 !(client_p
->umodes
& modes_nak
)) ?
80 EXTBAN_MATCH
: EXTBAN_NOMATCH
;