]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showwhois.cpp
Merge branch 'master+gnutlsprio'
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
index 7a3b2d352099105b645e9bc3f9b09ea773fc0bcb..3cb85f3fb1b18d502ee393cddbc1c01d9694351f 100644 (file)
@@ -42,7 +42,7 @@ class SeeWhois : public SimpleUserModeHandler
 class WhoisNoticeCmd : public Command
 {
  public:
-       WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 1)
+       WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 2)
        {
                flags_needed = FLAG_SERVERONLY;
        }
@@ -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())
@@ -110,14 +114,11 @@ class ModuleShowwhois : public Module
                else
                {
                        std::vector<std::string> params;
-                       params.push_back(dest->server->GetName());
-                       params.push_back("WHOISNOTICE");
                        params.push_back(dest->uuid);
                        params.push_back(source->uuid);
-                       ServerInstance->PI->SendEncapsulatedData(params);
+                       ServerInstance->PI->SendEncapsulatedData(dest->server->GetName(), cmd.name, params);
                }
        }
 };
 
 MODULE_INIT(ModuleShowwhois)
-