]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * Extended extban type: bans all users with matching nick!user@host#gecos. | |
3 | * Requested by Lockwood. | |
4 | * - nenolod | |
212380e3 AC |
5 | */ |
6 | ||
7 | #include "stdinc.h" | |
8 | #include "modules.h" | |
9 | #include "client.h" | |
10 | #include "ircd.h" | |
11 | ||
eeabf33a EM |
12 | static const char extb_desc[] = "Extended mask ($x) extban type"; |
13 | ||
212380e3 AC |
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 | ||
c81afd15 | 18 | DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc); |
212380e3 AC |
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 | int ret; | |
39 | ||
40 | (void)chptr; | |
41 | ||
42 | if (data == NULL) | |
43 | return EXTBAN_INVALID; | |
44 | ||
5203cba5 | 45 | snprintf(buf, BUFSIZE, "%s!%s@%s#%s", |
212380e3 AC |
46 | client_p->name, client_p->username, client_p->host, client_p->info); |
47 | ||
48 | ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; | |
49 | ||
50 | if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) | |
51 | { | |
5203cba5 | 52 | snprintf(buf, BUFSIZE, "%s!%s@%s#%s", |
212380e3 AC |
53 | client_p->name, client_p->username, client_p->orighost, client_p->info); |
54 | ||
55 | ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; | |
56 | } | |
57 | ||
58 | return ret; | |
59 | } |