]> jfr.im git - solanum.git/blob - extensions/extb_extgecos.c
m_stats: z: remove unnecessary casting and fix format strings
[solanum.git] / extensions / extb_extgecos.c
1 /*
2 * Extended extban type: bans all users with matching nick!user@host#gecos.
3 * Requested by Lockwood.
4 * - nenolod
5 */
6
7 #include "stdinc.h"
8 #include "modules.h"
9 #include "client.h"
10 #include "ircd.h"
11
12 static const char extb_desc[] = "Extended mask ($x) extban type";
13
14 static int _modinit(void);
15 static void _moddeinit(void);
16 static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
17
18 DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
19
20 static int
21 _modinit(void)
22 {
23 extban_table['x'] = eb_extended;
24
25 return 0;
26 }
27
28 static void
29 _moddeinit(void)
30 {
31 extban_table['x'] = NULL;
32 }
33
34 static int eb_extended(const char *data, struct Client *client_p,
35 struct Channel *chptr, long mode_type)
36 {
37 char buf[BUFSIZE];
38
39 (void)chptr;
40
41 if (data == NULL)
42 return EXTBAN_INVALID;
43
44 snprintf(buf, sizeof buf, "%s!%s@%s#%s",
45 client_p->name, client_p->username, client_p->host, client_p->info);
46
47 return match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
48 }