X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nickflood.cpp;h=a267cd4043d448031046c3cd29db7e297bad9c91;hb=b43fc66c17c2bef6dca66a966676b8128d5774ee;hp=4e6dca5b9ea376f3cdcaa40a0bac1eb2e864715e;hpb=6d03943426dcce76ba66567a9b18425a5ebb4c0c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 4e6dca5b9..a267cd404 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -17,7 +17,7 @@ /** Holds settings and state associated with channel mode +F */ -class nickfloodsettings : public classbase +class nickfloodsettings { public: int secs; @@ -89,7 +89,7 @@ class NickFlood : public ModeHandler { public: SimpleExtItem ext; - NickFlood(Module* Creator) : ModeHandler(Creator, 'F', PARAM_SETONLY, MODETYPE_CHANNEL), + NickFlood(Module* Creator) : ModeHandler(Creator, "nickflood", 'F', PARAM_SETONLY, MODETYPE_CHANNEL), ext("nickflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -200,7 +200,7 @@ class ModuleNickFlood : public Module { if (!ServerInstance->Modes->AddMode(&nf)) throw ModuleException("Could not add new modes!"); - Extensible::Register(&nf.ext); + ServerInstance->Extensions.Register(&nf.ext); Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -213,11 +213,13 @@ class ModuleNickFlood : public Module for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) { Channel *channel = *i; + ModResult res; nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood")); + if (res == MOD_RES_ALLOW) continue; if (f->islocked()) @@ -230,7 +232,7 @@ class ModuleNickFlood : public Module { 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); + 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; } } @@ -250,11 +252,13 @@ class ModuleNickFlood : public Module for (UCListIter i = user->chans.begin(); i != user->chans.end(); ++i) { Channel *channel = *i; + ModResult res; nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood")); + if (res == MOD_RES_ALLOW) return; /* moved this here to avoid incrementing the counter for nick @@ -269,7 +273,6 @@ class ModuleNickFlood : public Module ~ModuleNickFlood() { - ServerInstance->Modes->DelMode(&nf); } Version GetVersion()