X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nickflood.cpp;h=48f085dde937201623e3a2a9a47a9e8fff7cdf78;hb=9982ec4e5b027ed24b1fda5e6fd3ab35b98de1a7;hp=a4a87f6916d72a9722f7c3089239770593598036;hpb=02497bfa999da26c19a92d8620c35bb97f1da711;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index a4a87f691..48f085dde 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -54,10 +54,6 @@ class nickfloodsettings bool shouldlock() { - /* XXX HACK: using counter + 1 here now to allow the counter to only be incremented - * on successful nick changes; this will be checked before the counter is - * incremented. - */ return ((ServerInstance->Time() <= reset) && (counter == this->nicks)); } @@ -88,24 +84,25 @@ class NickFlood : public ParamMode > NickFlood(Module* Creator) : ParamMode >(Creator, "nickflood", 'F') { + syntax = ":"; } - ModeAction OnSet(User* source, Channel* channel, std::string& parameter) + ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE { std::string::size_type colon = parameter.find(':'); if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos)) { - source->WriteNumeric(608, channel->name, "Invalid flood parameter"); + source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter)); return MODEACTION_DENY; } /* Set up the flood parameters for this channel */ - unsigned int nnicks = ConvToInt(parameter.substr(0, colon)); - unsigned int nsecs = ConvToInt(parameter.substr(colon+1)); + unsigned int nnicks = ConvToNum(parameter.substr(0, colon)); + unsigned int nsecs = ConvToNum(parameter.substr(colon+1)); if ((nnicks<1) || (nsecs<1)) { - source->WriteNumeric(608, channel->name, "Invalid flood parameter"); + source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter)); return MODEACTION_DENY; } @@ -148,7 +145,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, channel, "nickflood")); + res = CheckExemption::Call(exemptionprov, user, channel, "nickflood"); if (res == MOD_RES_ALLOW) continue; @@ -187,7 +184,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, channel, "nickflood")); + res = CheckExemption::Call(exemptionprov, user, channel, "nickflood"); if (res == MOD_RES_ALLOW) return; @@ -202,7 +199,7 @@ class ModuleNickFlood : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Channel mode F - nick flood protection", VF_VENDOR); + return Version("Provides channel mode +F, nick flood protection", VF_VENDOR); } };