]> jfr.im git - irc/rqf/shadowircd.git/blob - extensions/extb_extgecos.c
Removal of ancient SVN ID's part one
[irc/rqf/shadowircd.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
8 #include "stdinc.h"
9 #include "modules.h"
10 #include "client.h"
11 #include "ircd.h"
12
13 static int _modinit(void);
14 static void _moddeinit(void);
15 static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
16
17 DECLARE_MODULE_AV1(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1339 $");
18
19 static int
20 _modinit(void)
21 {
22 extban_table['x'] = eb_extended;
23
24 return 0;
25 }
26
27 static void
28 _moddeinit(void)
29 {
30 extban_table['x'] = NULL;
31 }
32
33 static int eb_extended(const char *data, struct Client *client_p,
34 struct Channel *chptr, long mode_type)
35 {
36 char buf[BUFSIZE];
37 int ret;
38
39 (void)chptr;
40
41 if (data == NULL)
42 return EXTBAN_INVALID;
43
44 rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
45 client_p->name, client_p->username, client_p->host, client_p->info);
46
47 ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
48
49 if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p))
50 {
51 rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
52 client_p->name, client_p->username, client_p->orighost, client_p->info);
53
54 ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
55 }
56
57 return ret;
58 }