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));
}
NickFlood(Module* Creator)
: ParamMode<NickFlood, SimpleExtItem<nickfloodsettings> >(Creator, "nickflood", 'F')
{
+ syntax = "<nick-changes>:<seconds>";
}
- 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<unsigned int>(parameter.substr(0, colon));
+ unsigned int nsecs = ConvToNum<unsigned int>(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;
}
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);
}
};