2007-05-24 05:58:27 +02:00
|
|
|
/*
|
|
|
|
* +W snomask: Displays if a local user has done a WHOIS request on you.
|
|
|
|
* derived from spy_whois_notice.c.
|
|
|
|
*
|
2007-05-30 12:22:25 +02:00
|
|
|
* If #define OPERONLY is removed, then any user can use this snomask
|
|
|
|
* (you need to put ~servnotice in oper_only_umodes for this to work).
|
2007-05-24 05:58:27 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "hook.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
#include "send.h"
|
|
|
|
|
|
|
|
/* undefine this to allow anyone to receive whois notifications */
|
|
|
|
#define OPERONLY
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char sno_desc[] =
|
|
|
|
"Adds server notice mask +W that allows "
|
|
|
|
#ifdef OPERONLY
|
|
|
|
"operators"
|
|
|
|
#else
|
|
|
|
"users"
|
|
|
|
#endif
|
|
|
|
" to receive notices for when a WHOIS has been done on them";
|
|
|
|
|
2007-05-24 05:58:27 +02:00
|
|
|
void show_whois(hook_data_client *);
|
|
|
|
|
|
|
|
mapi_hfn_list_av1 whois_hfnlist[] = {
|
|
|
|
{"doing_whois", (hookfn) show_whois},
|
2007-05-24 06:01:12 +02:00
|
|
|
{"doing_whois_global", (hookfn) show_whois},
|
2007-05-24 05:58:27 +02:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
init(void)
|
|
|
|
{
|
|
|
|
snomask_modes['W'] = find_snomask_slot();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fini(void)
|
|
|
|
{
|
2015-12-28 00:08:57 +01:00
|
|
|
snomask_modes['W'] = 0;
|
2007-05-24 05:58:27 +02:00
|
|
|
}
|
|
|
|
|
2016-03-07 11:02:27 +01:00
|
|
|
DECLARE_MODULE_AV2(sno_whois, init, fini, NULL, NULL, whois_hfnlist, NULL, NULL, sno_desc);
|
2007-05-24 05:58:27 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
show_whois(hook_data_client *data)
|
|
|
|
{
|
|
|
|
struct Client *source_p = data->client;
|
|
|
|
struct Client *target_p = data->target;
|
|
|
|
|
2014-03-03 05:25:47 +01:00
|
|
|
if(MyClient(target_p) &&
|
2007-05-24 05:58:27 +02:00
|
|
|
#ifdef OPERONLY
|
|
|
|
IsOper(target_p) &&
|
|
|
|
#endif
|
|
|
|
(source_p != target_p) &&
|
|
|
|
(target_p->snomask & snomask_modes['W']))
|
|
|
|
{
|
|
|
|
sendto_one_notice(target_p,
|
|
|
|
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
|
|
|
|
source_p->name,
|
|
|
|
source_p->username, source_p->host,
|
2007-11-20 13:36:55 +01:00
|
|
|
source_p->servptr->name);
|
2007-05-24 05:58:27 +02:00
|
|
|
}
|
|
|
|
}
|