X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_repeat.cpp;h=6c34648e0cadd210157ed785b04add2d3262c1a7;hb=e7c829af5941c6a8a303ca75ed9ac47570347e41;hp=820ef702fd895e1bdd7a742f9e4b934dd94440fa;hpb=8f5efbc7aa33b792e02d01e3288f553e6e98ccaa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index 820ef702f..6c34648e0 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class ChannelSettings { @@ -110,7 +111,7 @@ class RepeatMode : public ParamMode > { mx[1][0] = i + 1; for (unsigned int j = 0; j < l2; j++) - mx[1][j + 1] = std::min(std::min(mx[1][j] + 1, mx[0][j + 1] + 1), mx[0][j] + ((s1[i] == s2[j]) ? 0 : 1)); + mx[1][j + 1] = std::min(std::min(mx[1][j] + 1, mx[0][j + 1] + 1), mx[0][j] + ((s1[i] == s2[j]) ? 0 : 1)); mx[0].swap(mx[1]); } @@ -232,7 +233,7 @@ class RepeatMode : public ParamMode > 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 > 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,14 +369,16 @@ class RepeatModule : public Module if (!memb) return MOD_RES_PASSTHRU; - if (ServerInstance->OnCheckExemption(user, chan, "repeat") == MOD_RES_ALLOW) + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, chan, "repeat")); + if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; if (rm.MatchLine(memb, settings, text)) { if (settings->Action == ChannelSettings::ACT_BLOCK) { - user->WriteNotice("*** This line is too similiar to one of your last lines."); + user->WriteNotice("*** This line is too similar to one of your last lines."); return MOD_RES_DENY; } @@ -394,7 +402,7 @@ class RepeatModule : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the +E channel mode - for blocking of similiar messages", VF_COMMON|VF_VENDOR, rm.GetModuleSettings()); + return Version("Provides the +E channel mode - for blocking of similar messages", VF_COMMON|VF_VENDOR, rm.GetModuleSettings()); } };