]> jfr.im git - solanum.git/blob - extensions/extb_extgecos.c
Bump all extensions to AV2
[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 int _modinit(void);
13 static void _moddeinit(void);
14 static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
15
16 DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, NULL);
17
18 static int
19 _modinit(void)
20 {
21 extban_table['x'] = eb_extended;
22
23 return 0;
24 }
25
26 static void
27 _moddeinit(void)
28 {
29 extban_table['x'] = NULL;
30 }
31
32 static int eb_extended(const char *data, struct Client *client_p,
33 struct Channel *chptr, long mode_type)
34 {
35 char buf[BUFSIZE];
36 int ret;
37
38 (void)chptr;
39
40 if (data == NULL)
41 return EXTBAN_INVALID;
42
43 snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
44 client_p->name, client_p->username, client_p->host, client_p->info);
45
46 ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
47
48 if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p))
49 {
50 snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
51 client_p->name, client_p->username, client_p->orighost, client_p->info);
52
53 ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
54 }
55
56 return ret;
57 }