]>
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 | 7 | * |
5832fa36 | 8 | * $Id: sno_whois.c 3498 2007-05-30 10:22:25Z jilles $ |
9e6feafe AC |
9 | */ |
10 | ||
11 | #include "stdinc.h" | |
12 | #include "modules.h" | |
13 | #include "hook.h" | |
14 | #include "client.h" | |
15 | #include "ircd.h" | |
16 | #include "send.h" | |
17 | ||
18 | /* undefine this to allow anyone to receive whois notifications */ | |
19 | #define OPERONLY | |
20 | ||
21 | void show_whois(hook_data_client *); | |
22 | ||
23 | mapi_hfn_list_av1 whois_hfnlist[] = { | |
24 | {"doing_whois", (hookfn) show_whois}, | |
3868ef9a | 25 | {"doing_whois_global", (hookfn) show_whois}, |
9e6feafe AC |
26 | {NULL, NULL} |
27 | }; | |
28 | ||
29 | static int | |
30 | init(void) | |
31 | { | |
32 | snomask_modes['W'] = find_snomask_slot(); | |
33 | ||
34 | return 0; | |
35 | } | |
36 | ||
37 | static void | |
38 | fini(void) | |
39 | { | |
40 | snomask_modes['W'] = find_snomask_slot(); | |
41 | } | |
42 | ||
5832fa36 | 43 | DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3498 $"); |
9e6feafe AC |
44 | |
45 | void | |
46 | show_whois(hook_data_client *data) | |
47 | { | |
48 | struct Client *source_p = data->client; | |
49 | struct Client *target_p = data->target; | |
50 | ||
55abcbb2 | 51 | if(MyClient(target_p) && |
9e6feafe AC |
52 | #ifdef OPERONLY |
53 | IsOper(target_p) && | |
54 | #endif | |
55 | (source_p != target_p) && | |
56 | (target_p->snomask & snomask_modes['W'])) | |
57 | { | |
58 | sendto_one_notice(target_p, | |
59 | ":*** Notice -- %s (%s@%s) is doing a whois on you [%s]", | |
60 | source_p->name, | |
61 | source_p->username, source_p->host, | |
c88cdb00 | 62 | source_p->servptr->name); |
9e6feafe AC |
63 | } |
64 | } |