summaryrefslogtreecommitdiff
path: root/src/modules/m_messageflood.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_messageflood.cpp')
-rw-r--r--src/modules/m_messageflood.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 92d67b9ab..7323605cb 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -34,7 +34,7 @@ class floodsettings
unsigned int secs;
unsigned int lines;
time_t reset;
- std::map<User*, unsigned int> counters;
+ insp::flat_map<User*, unsigned int> counters;
floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c)
{
@@ -54,11 +54,7 @@ class floodsettings
void clear(User* who)
{
- std::map<User*, unsigned int>::iterator iter = counters.find(who);
- if (iter != counters.end())
- {
- counters.erase(iter);
- }
+ counters.erase(who);
}
};
@@ -77,7 +73,7 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> >
std::string::size_type colon = parameter.find(':');
if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -88,7 +84,7 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> >
if ((nlines<2) || (nsecs<1))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -137,15 +133,13 @@ class ModuleMsgFlood : public Module
f->clear(user);
if (f->ban)
{
- std::vector<std::string> parameters;
- parameters.push_back(dest->name);
- parameters.push_back("+b");
- parameters.push_back("*!*@" + user->dhost);
- ServerInstance->Modes->Process(parameters, ServerInstance->FakeClient);
+ Modes::ChangeList changelist;
+ changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->dhost);
+ ServerInstance->Modes->Process(ServerInstance->FakeClient, dest, NULL, changelist);
}
- const std::string kickMessage = "Channel flood triggered (limit is " + ConvToStr(f->lines) +
- " in " + ConvToStr(f->secs) + " secs)";
+ const std::string kickMessage = "Channel flood triggered (trigger is " + ConvToStr(f->lines) +
+ " lines in " + ConvToStr(f->secs) + " secs)";
dest->KickUser(ServerInstance->FakeClient, user, kickMessage);