aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-07-05 16:49:52 +0100
committerGravatar Sadie Powell2021-07-05 16:49:52 +0100
commitfb91c4279bed48860ab9fb127cc657d90ef9b51b (patch)
tree89ec5d6715d31bcd2a6d9e5cfce865494f344512 /src
parentStop sending RPL_WHOISSERVICE as it conflicts with RPL_WHOISHELPOP. (diff)
Don't send oper swhois to users with hideoper enabled.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_swhois.cpp30
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;
}