]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_repeat.cpp
Fix the cloaking module on C++98 compilers.
[user/henk/code/inspircd.git] / src / modules / m_repeat.cpp
index 2b2d080a4cff205ad27c88a248b8dd1abc3e9916..5a532389a8eef17b7ff35343afd05689589fc522 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2021 iwalkalone <iwalkalone69@gmail.com>
  *   Copyright (C) 2019 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2018-2019 linuxdaemon <linuxdaemon.irc@gmail.com>
  *   Copyright (C) 2018 Matt Schatz <genius3000@g3k.solutions>
@@ -90,6 +91,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                unsigned int MaxBacklog;
                unsigned int MaxDiff;
                unsigned int MaxMessageSize;
+               std::string KickMessage;
                ModuleSettings() : MaxLines(0), MaxSecs(0), MaxBacklog(0), MaxDiff() { }
        };
 
@@ -251,6 +253,8 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                if (newsize > ServerInstance->Config->Limits.MaxLine)
                        newsize = ServerInstance->Config->Limits.MaxLine;
                Resize(newsize);
+
+               ms.KickMessage = conf->getString("kickmessage", "Repeat flood");
        }
 
        std::string GetModuleSettings() const
@@ -258,6 +262,11 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                return ConvToStr(ms.MaxLines) + ":" + ConvToStr(ms.MaxSecs) + ":" + ConvToStr(ms.MaxDiff) + ":" + ConvToStr(ms.MaxBacklog);
        }
 
+       std::string GetKickMessage() const
+       {
+               return ms.KickMessage;
+       }
+
        void SerializeParam(Channel* chan, const ChannelSettings* chset, std::string& out)
        {
                chset->serialize(out);
@@ -402,7 +411,7 @@ class RepeatModule : public Module
                                ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist);
                        }
 
-                       memb->chan->KickUser(ServerInstance->FakeClient, user, "Repeat flood");
+                       memb->chan->KickUser(ServerInstance->FakeClient, user, rm.GetKickMessage());
                        return MOD_RES_DENY;
                }
                return MOD_RES_PASSTHRU;
@@ -415,7 +424,7 @@ class RepeatModule : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides channel mode +E, blocking of similar messages", VF_COMMON|VF_VENDOR, rm.GetModuleSettings());
+               return Version("Adds channel mode E (repeat) which helps protect against spammers which spam the same message repeatedly.", VF_COMMON|VF_VENDOR, rm.GetModuleSettings());
        }
 };