]> jfr.im git - solanum.git/blame - extensions/sno_whois.c
[svn] Tweak NEWS a little.
[solanum.git] / extensions / sno_whois.c
CommitLineData
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 *
5 * If #define OPERONLY is removed, then any user can use this snomask.
6 *
3868ef9a 7 * $Id: sno_whois.c 3470 2007-05-24 04:01:12Z nenolod $
9e6feafe
AC
8 */
9
10#include "stdinc.h"
11#include "modules.h"
12#include "hook.h"
13#include "client.h"
14#include "ircd.h"
15#include "send.h"
16
17/* undefine this to allow anyone to receive whois notifications */
18#define OPERONLY
19
20void show_whois(hook_data_client *);
21
22mapi_hfn_list_av1 whois_hfnlist[] = {
23 {"doing_whois", (hookfn) show_whois},
3868ef9a 24 {"doing_whois_global", (hookfn) show_whois},
9e6feafe
AC
25 {NULL, NULL}
26};
27
28static int
29init(void)
30{
31 snomask_modes['W'] = find_snomask_slot();
32
33 return 0;
34}
35
36static void
37fini(void)
38{
39 snomask_modes['W'] = find_snomask_slot();
40}
41
3868ef9a 42DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3470 $");
9e6feafe
AC
43
44void
45show_whois(hook_data_client *data)
46{
47 struct Client *source_p = data->client;
48 struct Client *target_p = data->target;
49
50 /* source being MyConnect() is implicit here from m_whois.c --fl */
51 if(MyClient(target_p) &&
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,
62 source_p->user->server);
63 }
64}