aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-06-15 17:03:55 +0100
committerGravatar Sadie Powell2022-06-15 17:05:03 +0100
commit503df0bed93a480f8a01f1ab5c4d04fccd0ae634 (patch)
tree619ca908d3cc4367c6b7eb8d5e17fcb045ba70ff /src/modules
parentConvert passforward to use the new template system. (diff)
Allow templating of the repeat module kick message.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_repeat.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index bc760499a..db7a76ed9 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -252,12 +252,7 @@ public:
newsize = ServerInstance->Config->Limits.MaxLine;
Resize(newsize);
- ms.KickMessage = conf->getString("kickmessage", "Repeat flood");
- }
-
- std::string GetKickMessage() const
- {
- return ms.KickMessage;
+ ms.KickMessage = conf->getString("kickmessage", "Repeat flood (trigger is %lines% messages in %duration%)", 1);
}
void SerializeParam(Channel* chan, const ChannelSettings* chset, std::string& out)
@@ -412,7 +407,13 @@ public:
ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, nullptr, changelist);
}
- memb->chan->KickUser(ServerInstance->FakeClient, user, rm.GetKickMessage());
+ const std::string kickmsg = Template::Replace(rm.ms.KickMessage, {
+ { "diff", ConvToStr(settings->Diff) },
+ { "duration", InspIRCd::DurationString(settings->Seconds) },
+ { "lines", ConvToStr(settings->Lines) },
+ { "seconds", ConvToStr(settings->Seconds) },
+ });
+ memb->chan->KickUser(ServerInstance->FakeClient, user, kickmsg);
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;