]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showwhois.cpp
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
index 93c3a7e60ded72eb6719a5f9c083702ce57951fa..bf3028c122e233febc6664b1a6596bd45ee57625 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
-
 /** Handle user mode +W
  */
 class SeeWhois : public SimpleUserModeHandler
@@ -46,9 +44,9 @@ class WhoisNoticeCmd : public Command
 
        void HandleFast(User* dest, User* src)
        {
-               dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you",
-                       dest->nick.c_str(), src->nick.c_str(), src->ident.c_str(),
-                       dest->HasPrivPermission("users/auspex") ? src->host.c_str() : src->dhost.c_str());
+               dest->WriteNotice("*** " + src->nick + " (" + src->ident + "@" +
+                       (dest->HasPrivPermission("users/auspex") ? src->host : src->dhost) +
+                       ") did a /whois on you");
        }
 
        CmdResult Handle(const std::vector<std::string> &parameters, User *user)
@@ -79,7 +77,7 @@ class ModuleShowwhois : public Module
        {
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois");
 
@@ -89,8 +87,6 @@ class ModuleShowwhois : public Module
                sw = new SeeWhois(this, OpersOnly);
                ServerInstance->Modules->AddService(*sw);
                ServerInstance->Modules->AddService(cmd);
-               Implementation eventlist[] = { I_OnWhois };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        ~ModuleShowwhois()
@@ -98,17 +94,17 @@ class ModuleShowwhois : public Module
                delete sw;
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Allows opers to set +W to see when a user uses WHOIS on them",VF_OPTCOMMON|VF_VENDOR);
        }
 
-       void OnWhois(User* source, User* dest)
+       void OnWhois(User* source, User* dest) CXX11_OVERRIDE
        {
-               if (!dest->IsModeSet('W') || source == dest)
+               if (!dest->IsModeSet(*sw) || source == dest)
                        return;
 
-               if (!ShowWhoisFromOpers && IS_OPER(source))
+               if (!ShowWhoisFromOpers && source->IsOper())
                        return;
 
                if (IS_LOCAL(dest))