]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showwhois.cpp
Hide User#host and User#dhost and use accessors to modify them.
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
index ba17942cbbc32eb52871c4fe15b5e9c5fe437682..99774563d3d827a7b7612210afb8eb8962c7e87d 100644 (file)
@@ -50,7 +50,7 @@ class WhoisNoticeCmd : public Command
        void HandleFast(User* dest, User* src)
        {
                dest->WriteNotice("*** " + src->nick + " (" + src->ident + "@" +
-                       (dest->HasPrivPermission("users/auspex") ? src->host : src->dhost) +
+                       src->GetHost(dest->HasPrivPermission("users/auspex")) + 
                        ") did a /whois on you");
        }
 
@@ -69,7 +69,7 @@ class WhoisNoticeCmd : public Command
        }
 };
 
-class ModuleShowwhois : public Module
+class ModuleShowwhois : public Module, public Whois::EventListener
 {
        bool ShowWhoisFromOpers;
        SeeWhois sw;
@@ -78,7 +78,9 @@ class ModuleShowwhois : public Module
  public:
 
        ModuleShowwhois()
-               : sw(this), cmd(this)
+               : Whois::EventListener(this)
+               , sw(this)
+               , cmd(this)
        {
        }
 
@@ -95,9 +97,11 @@ class ModuleShowwhois : public Module
                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) CXX11_OVERRIDE
+       void OnWhois(Whois::Context& whois) CXX11_OVERRIDE
        {
-               if (!dest->IsModeSet(sw) || source == dest)
+               User* const source = whois.GetSource();
+               User* const dest = whois.GetTarget();
+               if (!dest->IsModeSet(sw) || whois.IsSelfWhois())
                        return;
 
                if (!ShowWhoisFromOpers && source->IsOper())