summaryrefslogtreecommitdiff
path: root/src/modules/m_servprotect.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-05-04 13:24:48 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-05-04 13:24:48 +0200
commit4711113dff7fc33c96f95f417f2813f28c690e01 (patch)
tree7ccecb9e52f6c13c233a3efe312410a1c8e526a0 /src/modules/m_servprotect.cpp
parent8aa03e455e14ea85cdee65527565975ddf558b88 (diff)
parent68bb6a67459298ca08eb18b60794619ddf782c77 (diff)
Merge branch 'master+whoiscontext'
Diffstat (limited to 'src/modules/m_servprotect.cpp')
-rw-r--r--src/modules/m_servprotect.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 26453020f..2ed37b9e4 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -42,12 +42,13 @@ class ServProtectMode : public ModeHandler
}
};
-class ModuleServProtectMode : public Module
+class ModuleServProtectMode : public Module, public Whois::EventListener
{
ServProtectMode bm;
public:
ModuleServProtectMode()
- : bm(this)
+ : Whois::EventListener(this)
+ , bm(this)
{
}
@@ -56,11 +57,11 @@ class ModuleServProtectMode : public Module
return Version("Provides usermode +k to protect services from kicks, kills, and mode changes.", VF_VENDOR);
}
- void OnWhois(User* user, User* dest) CXX11_OVERRIDE
+ void OnWhois(Whois::Context& whois) CXX11_OVERRIDE
{
- if (dest->IsModeSet(bm))
+ if (whois.GetTarget()->IsModeSet(bm))
{
- ServerInstance->SendWhoisLine(user, dest, 310, dest->nick+" :is a Network Service on "+ServerInstance->Config->Network);
+ whois.SendLine(310, ":is a Network Service on " + ServerInstance->Config->Network);
}
}
@@ -121,7 +122,7 @@ class ModuleServProtectMode : public Module
ModResult OnWhoisLine(User* src, User* dst, int &numeric, std::string &text) CXX11_OVERRIDE
{
- return ((src != dst) && (numeric == 319) && dst->IsModeSet(bm)) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
+ return ((numeric == 319) && dst->IsModeSet(bm)) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
};