summaryrefslogtreecommitdiff
path: root/src/modules/m_exemptchanops.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-03-20 11:43:24 +0000
committerPeter Powell <petpow@saberuk.com>2017-03-20 11:47:59 +0000
commit81027f3a0888ac4c8e3fb6ea90081492defce946 (patch)
treea8da074f8feb486af8ef4aebf67e8c901f2340f3 /src/modules/m_exemptchanops.cpp
parent5583d8dc5ff202d411d7985b6bbfb240beeacddd (diff)
Move the OnCheckExemption hook out of the core.
Diffstat (limited to 'src/modules/m_exemptchanops.cpp')
-rw-r--r--src/modules/m_exemptchanops.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp
index 2884385fb..0c67037f0 100644
--- a/src/modules/m_exemptchanops.cpp
+++ b/src/modules/m_exemptchanops.cpp
@@ -19,6 +19,7 @@
#include "inspircd.h"
#include "listmode.h"
+#include "modules/exemption.h"
/** Handles channel mode +X
*/
@@ -68,11 +69,15 @@ class ExemptChanOps : public ListModeBase
}
};
-class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std::string&>
+class ExemptHandler : public CheckExemption::EventListener
{
public:
ExemptChanOps ec;
- ExemptHandler(Module* me) : ec(me) {}
+ ExemptHandler(Module* me)
+ : CheckExemption::EventListener(me)
+ , ec(me)
+ {
+ }
PrefixMode* FindMode(const std::string& mid)
{
@@ -83,7 +88,7 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std:
return mh ? mh->IsPrefixMode() : NULL;
}
- ModResult Call(User* user, Channel* chan, const std::string& restriction)
+ ModResult OnCheckExemption(User* user, Channel* chan, const std::string& restriction) CXX11_OVERRIDE
{
unsigned int mypfx = chan->GetPrefixValue(user);
std::string minmode;
@@ -108,7 +113,7 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std:
if (mh || minmode == "*")
return MOD_RES_DENY;
- return ServerInstance->HandleOnCheckExemption.Call(user, chan, restriction);
+ return MOD_RES_PASSTHRU;
}
};
@@ -121,16 +126,6 @@ class ModuleExemptChanOps : public Module
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->OnCheckExemption = &eh;
- }
-
- ~ModuleExemptChanOps()
- {
- ServerInstance->OnCheckExemption = &ServerInstance->HandleOnCheckExemption;
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the ability to allow channel operators to be exempt from certain modes.",VF_VENDOR);