class NickFlood : public ModeHandler
{
public:
- NickFlood(InspIRCd* Instance) : ModeHandler(Instance, 'F', 1, 0, false, MODETYPE_CHANNEL, false) { }
+ NickFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'F', 1, 0, false, MODETYPE_CHANNEL, false) { }
ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter)
{
return std::make_pair(false, parameter);
}
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
nickfloodsettings* dummy;
public:
ModuleNickFlood(InspIRCd* Me)
- : Module(Me), jf(Me)
+ : Module(Me), jf(Me, this)
{
if (!ServerInstance->Modes->AddMode(&jf))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->Attach(eventlist, this, 3);
}
- virtual int OnUserPreNick(User* user, const std::string &newnick)
+ virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
{
if (isdigit(newnick[0])) /* allow switches to UID */
- return 0;
+ return MOD_RES_PASSTHRU;
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
if (f->islocked())
{
user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick.c_str(), channel->name.c_str(), f->nicks, f->secs);
- return 1;
+ return MOD_RES_DENY;
}
if (f->shouldlock())
f->clear();
f->lock();
channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name.c_str(), f->nicks, f->secs);
- return 1;
+ return MOD_RES_DENY;
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
/*