summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriwalkalone <iwalkalone69@users.noreply.github.com>2021-01-18 08:22:44 +0100
committerGitHub <noreply@github.com>2021-01-18 07:22:44 +0000
commit6223be60dee0aa4f69b53b102a9d1aadd0dde047 (patch)
treee4a4465e6d9fca4a58e1c2a828c1f54f2ab32307
parentf9a663185402b9689c784dc87c317ac204c53f03 (diff)
Implemented configurable kick message for the repeat module (#1835).
-rw-r--r--docs/conf/modules.conf.example8
-rw-r--r--src/modules/m_repeat.cpp10
2 files changed, 16 insertions, 2 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 0a85ef5ca..2f38f52a4 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -1900,7 +1900,13 @@
# less CPU usage. Increasing this beyond 512 doesn't have
# any effect, as the maximum length of a message on IRC
# cannot exceed that.
-#<repeat maxbacklog="20" maxdistance="50" maxlines="20" maxtime="0" size="512">
+# kickmessage - Kick message when * is specified
+#<repeat maxbacklog="20"
+# maxdistance="50"
+# maxlines="20"
+# maxtime="0s"
+# size="512"
+# kickmessage="Repeat flood">
#<module name="repeat">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index 89f5a1291..e6568732b 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -90,6 +90,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 +252,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 +261,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 +410,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;