]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_repeat.cpp
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / src / modules / m_repeat.cpp
index 57a6edab6b7842e09b51180d1ac18757a76f67a2..33ca5b057d33d8de42fa3c876e3ad7ea6dce247e 100644 (file)
@@ -1,6 +1,13 @@
 /*
  * 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>
+ *   Copyright (C) 2017-2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2015 James Lu <GLolol@overdrivenetworks.com>
+ *   Copyright (C) 2013-2015 Attila Molnar <attilamolnar@hush.com>
  *   Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
@@ -23,7 +30,7 @@
 class ChannelSettings
 {
  public:
-       enum RepeatAction
+       enum RepeatAction
        {
                ACT_KICK,
                ACT_BLOCK,
@@ -84,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() { }
        };
 
@@ -245,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
@@ -252,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);
@@ -396,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;
@@ -409,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());
        }
 };