]> jfr.im git - solanum.git/blobdiff - extensions/sno_whois.c
Merge pull request #288 from edk0/umode-o-split
[solanum.git] / extensions / sno_whois.c
index 6fed63caed31514848c6dad8ee91cf662e7e968c..eebc4d4ecb8fa8fa2caeb651b43ef2e84861b83f 100644 (file)
@@ -2,9 +2,8 @@
  * +W snomask: Displays if a local user has done a WHOIS request on you.
  * derived from spy_whois_notice.c.
  *
- * If #define OPERONLY is removed, then any user can use this snomask.
- *
- * $Id: sno_whois.c 3468 2007-05-24 03:58:27Z nenolod $
+ * 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).
  */
 
 #include "stdinc.h"
 #include "client.h"
 #include "ircd.h"
 #include "send.h"
+#include "s_newconf.h"
 
 /* undefine this to allow anyone to receive whois notifications */
 #define OPERONLY
 
+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";
+
 void show_whois(hook_data_client *);
 
 mapi_hfn_list_av1 whois_hfnlist[] = {
        {"doing_whois", (hookfn) show_whois},
+       {"doing_whois_global", (hookfn) show_whois},
        {NULL, NULL}
 };
 
@@ -35,10 +45,10 @@ init(void)
 static void
 fini(void)
 {
-       snomask_modes['W'] = find_snomask_slot();
+       snomask_modes['W'] = 0;
 }
 
-DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3468 $");
+DECLARE_MODULE_AV2(sno_whois, init, fini, NULL, NULL, whois_hfnlist, NULL, NULL, sno_desc);
 
 void
 show_whois(hook_data_client *data)
@@ -46,10 +56,9 @@ show_whois(hook_data_client *data)
        struct Client *source_p = data->client;
        struct Client *target_p = data->target;
 
-       /* source being MyConnect() is implicit here from m_whois.c --fl */
-       if(MyClient(target_p) && 
+       if(MyClient(target_p) &&
 #ifdef OPERONLY
-          IsOper(target_p) &&
+          IsOperGeneral(target_p) &&
 #endif
           (source_p != target_p) &&
           (target_p->snomask & snomask_modes['W']))
@@ -58,6 +67,6 @@ show_whois(hook_data_client *data)
                                ":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
                                source_p->name,
                                source_p->username, source_p->host,
-                               source_p->user->server);
+                               source_p->servptr->name);
        }
 }