]> jfr.im git - solanum.git/blame - extensions/extb_extgecos.c
More mailmap entries
[solanum.git] / extensions / extb_extgecos.c
CommitLineData
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
12static int _modinit(void);
13static void _moddeinit(void);
14static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
c81afd15 15static const char extb_desc[] = "Extended mask ($x) extban type";
212380e3 16
c81afd15 17DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
212380e3
AC
18
19static int
20_modinit(void)
21{
22 extban_table['x'] = eb_extended;
23
24 return 0;
25}
26
27static void
28_moddeinit(void)
29{
30 extban_table['x'] = NULL;
31}
32
33static 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
5203cba5 44 snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
212380e3
AC
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 {
5203cba5 51 snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
212380e3
AC
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}