]>
Commit | Line | Data |
---|---|---|
9e6feafe AC |
1 | /* |
2 | * +W snomask: Displays if a local user has done a WHOIS request on you. | |
3 | * derived from spy_whois_notice.c. | |
4 | * | |
5832fa36 JT |
5 | * If #define OPERONLY is removed, then any user can use this snomask |
6 | * (you need to put ~servnotice in oper_only_umodes for this to work). | |
9e6feafe AC |
7 | */ |
8 | ||
9 | #include "stdinc.h" | |
10 | #include "modules.h" | |
11 | #include "hook.h" | |
12 | #include "client.h" | |
13 | #include "ircd.h" | |
14 | #include "send.h" | |
15 | ||
16 | /* undefine this to allow anyone to receive whois notifications */ | |
17 | #define OPERONLY | |
18 | ||
19 | void show_whois(hook_data_client *); | |
20 | ||
21 | mapi_hfn_list_av1 whois_hfnlist[] = { | |
22 | {"doing_whois", (hookfn) show_whois}, | |
3868ef9a | 23 | {"doing_whois_global", (hookfn) show_whois}, |
9e6feafe AC |
24 | {NULL, NULL} |
25 | }; | |
26 | ||
27 | static int | |
28 | init(void) | |
29 | { | |
30 | snomask_modes['W'] = find_snomask_slot(); | |
31 | ||
32 | return 0; | |
33 | } | |
34 | ||
35 | static void | |
36 | fini(void) | |
37 | { | |
340b2512 | 38 | snomask_modes['W'] = 0; |
9e6feafe AC |
39 | } |
40 | ||
04f832b7 | 41 | DECLARE_MODULE_AV2(sno_whois, init, fini, NULL, NULL, whois_hfnlist, NULL, NULL, NULL); |
9e6feafe AC |
42 | |
43 | void | |
44 | show_whois(hook_data_client *data) | |
45 | { | |
46 | struct Client *source_p = data->client; | |
47 | struct Client *target_p = data->target; | |
48 | ||
55abcbb2 | 49 | if(MyClient(target_p) && |
9e6feafe AC |
50 | #ifdef OPERONLY |
51 | IsOper(target_p) && | |
52 | #endif | |
53 | (source_p != target_p) && | |
54 | (target_p->snomask & snomask_modes['W'])) | |
55 | { | |
56 | sendto_one_notice(target_p, | |
57 | ":*** Notice -- %s (%s@%s) is doing a whois on you [%s]", | |
58 | source_p->name, | |
59 | source_p->username, source_p->host, | |
c88cdb00 | 60 | source_p->servptr->name); |
9e6feafe AC |
61 | } |
62 | } |