diff options
| author | 2021-07-05 16:49:52 +0100 | |
|---|---|---|
| committer | 2021-07-05 16:49:52 +0100 | |
| commit | fb91c4279bed48860ab9fb127cc657d90ef9b51b (patch) | |
| tree | 89ec5d6715d31bcd2a6d9e5cfce865494f344512 /src/modules | |
| parent | Stop sending RPL_WHOISSERVICE as it conflicts with RPL_WHOISHELPOP. (diff) | |
Don't send oper swhois to users with hideoper enabled.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_swhois.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index de774a171..691e0a3a8 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -93,32 +93,38 @@ class CommandSwhois : public Command }; -class ModuleSWhois : public Module, public Whois::LineEventListener +class ModuleSWhois CXX11_FINAL + : public Module + , public Whois::LineEventListener { +private: CommandSwhois cmd; + UserModeReference hideopermode; public: ModuleSWhois() : Whois::LineEventListener(this) , cmd(this) + , hideopermode(this, "hideoper") { } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. ModResult OnWhoisLine(Whois::Context& whois, Numeric::Numeric& numeric) CXX11_OVERRIDE { - /* We use this and not OnWhois because this triggers for remote, too */ - if (numeric.GetNumeric() == 312) - { - /* Insert our numeric before 312 */ - std::string* swhois = cmd.swhois.get(whois.GetTarget()); - if (swhois) - { - whois.SendLine(RPL_WHOISSPECIAL, *swhois); - } - } + // We use this and not OnWhois because this triggers for remote users too. + if (numeric.GetNumeric() != RPL_WHOISSERVER) + return MOD_RES_PASSTHRU; + + // Don't send soper swhois if hideoper is set. + if (cmd.operblock.get(whois.GetTarget()) && whois.GetTarget()->IsModeSet(hideopermode)) + return MOD_RES_PASSTHRU; + + // Insert our numeric before RPL_WHOISSERVER. + const std::string* swhois = cmd.swhois.get(whois.GetTarget()); + if (swhois && !swhois->empty()) + whois.SendLine(RPL_WHOISSPECIAL, *swhois); - /* Dont block anything */ return MOD_RES_PASSTHRU; } |
