]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_repeat.cpp
Move OnSync{Channel,Network,User} to ServerEventListener.
[user/henk/code/inspircd.git] / src / modules / m_repeat.cpp
index 21bca0f3fd323a537f3b22c9f64870534297c8c1..75105ca0d5796718b5bb6738e5a3c52a63a93650 100644 (file)
@@ -18,6 +18,7 @@
 
 
 #include "inspircd.h"
+#include "modules/exemption.h"
 
 class ChannelSettings
 {
@@ -134,7 +135,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                        MemberInfoExt.unset(i->second);
        }
 
-       ModeAction OnSet(User* source, Channel* channel, std::string& parameter)
+       ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE
        {
                ChannelSettings settings;
                if (!ParseSettings(source, parameter, settings))
@@ -232,7 +233,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                ConfigTag* conf = ServerInstance->Config->ConfValue("repeat");
                ms.MaxLines = conf->getInt("maxlines", 20);
                ms.MaxBacklog = conf->getInt("maxbacklog", 20);
-               ms.MaxSecs = conf->getInt("maxsecs", 0);
+               ms.MaxSecs = conf->getDuration("maxtime", conf->getInt("maxsecs", 0));
 
                ms.MaxDiff = conf->getInt("maxdistance", 50);
                if (ms.MaxDiff > 100)
@@ -339,10 +340,15 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
 
 class RepeatModule : public Module
 {
+       CheckExemption::EventProvider exemptionprov;
        RepeatMode rm;
 
  public:
-       RepeatModule() : rm(this) {}
+       RepeatModule()
+               : exemptionprov(this)
+               , rm(this)
+       {
+       }
 
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
@@ -363,7 +369,8 @@ class RepeatModule : public Module
                if (!memb)
                        return MOD_RES_PASSTHRU;
 
-               if (ServerInstance->OnCheckExemption(user, chan, "repeat") == MOD_RES_ALLOW)
+               ModResult res = CheckExemption::Call(exemptionprov, user, chan, "repeat");
+               if (res == MOD_RES_ALLOW)
                        return MOD_RES_PASSTHRU;
 
                if (rm.MatchLine(memb, settings, text))
@@ -377,7 +384,7 @@ class RepeatModule : public Module
                        if (settings->Action == ChannelSettings::ACT_BAN)
                        {
                                Modes::ChangeList changelist;
-                               changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->dhost);
+                               changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
                                ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist);
                        }