if (isdigit(newnick[0])) /* allow switches to UID */
{
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++)
{
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
- Channel *channel = i->first;
+ Channel *channel = *i;
- nickfloodsettings *f;
- if (channel->GetExt("nickflood", f))
+ nickfloodsettings *f = nf.ext.get(channel);
+ if (f)
{
{
- if (CHANOPS_EXEMPT(ServerInstance, 'F') && channel->GetStatus(user) == STATUS_OP)
+ if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE)
continue;
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);
continue;
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;
}
}
- f->addnick();
if (f->shouldlock())
{
f->clear();
f->lock();
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;
+ channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName.c_str(), "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 MOD_RES_DENY;
}
}
}
}
}
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
}
- void OnChannelDelete(Channel* chan)
+ /*
+ * XXX: HACK: We do the increment on the *POST* event here (instead of all together) because we have no way of knowing whether other modules would block a nickchange.