]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_messageflood.cpp
Merge pull request #1271 from SaberUK/master+exemption
[user/henk/code/inspircd.git] / src / modules / m_messageflood.cpp
index 7323605cb0203c65435d28f6022eb6f08a1ef558..9d119b6c37cfc679e52315670acddb443ae7f70e 100644 (file)
@@ -24,6 +24,7 @@
 
 
 #include "inspircd.h"
+#include "modules/exemption.h"
 
 /** Holds flood settings and state for mode +f
  */
@@ -103,12 +104,14 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> >
 
 class ModuleMsgFlood : public Module
 {
+       CheckExemption::EventProvider exemptionprov;
        MsgFlood mf;
 
  public:
 
        ModuleMsgFlood()
-               : mf(this)
+               : exemptionprov(this)
+               , mf(this)
        {
        }
 
@@ -121,7 +124,9 @@ class ModuleMsgFlood : public Module
                if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
                        return MOD_RES_PASSTHRU;
 
-               if (ServerInstance->OnCheckExemption(user,dest,"flood") == MOD_RES_ALLOW)
+               ModResult res;
+               FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, dest, "flood"));
+               if (res == MOD_RES_ALLOW)
                        return MOD_RES_PASSTHRU;
 
                floodsettings *f = mf.ext.get(dest);
@@ -150,7 +155,7 @@ class ModuleMsgFlood : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       void Prioritize()
+       void Prioritize() CXX11_OVERRIDE
        {
                // we want to be after all modules that might deny the message (e.g. m_muteban, m_noctcp, m_blockcolor, etc.)
                ServerInstance->Modules->SetPriority(this, I_OnUserPreMessage, PRIORITY_LAST);