X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nickflood.cpp;h=c3cff2cd18566576962c4cead46e1cda67ec4341;hb=ad47ea662698e72ff8f79b03512b1e7fe81bdf53;hp=de9b64f9981bd967a5f1dbd93c43fdb217b95174;hpb=f3d134a5b642b83e865c03b45c313df7f829ba15;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index de9b64f99..c3cff2cd1 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -20,8 +20,6 @@ #include "inspircd.h" -/* $ModDesc: Provides channel mode +F (nick flood protection) */ - /** Holds settings and state associated with channel mode +F */ class nickfloodsettings @@ -94,7 +92,7 @@ class NickFlood : public ModeHandler std::string::size_type colon = parameter.find(':'); if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -104,7 +102,7 @@ class NickFlood : public ModeHandler if ((nnicks<1) || (nsecs<1)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -115,16 +113,14 @@ class NickFlood : public ModeHandler ext.set(channel, new nickfloodsettings(nsecs, nnicks)); parameter = ConvToStr(nnicks) + ":" + ConvToStr(nsecs); - channel->SetModeParam('F', parameter); return MODEACTION_ALLOW; } else { - if (!channel->IsModeSet('F')) + if (!channel->IsModeSet(this)) return MODEACTION_DENY; ext.unset(channel); - channel->SetModeParam('F', ""); return MODEACTION_ALLOW; } } @@ -140,14 +136,6 @@ class ModuleNickFlood : public Module { } - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->AddService(nf); - ServerInstance->Modules->AddService(nf.ext); - Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - ModResult OnUserPreNick(User* user, const std::string &newnick) CXX11_OVERRIDE { for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) @@ -164,7 +152,7 @@ class ModuleNickFlood : public Module if (f->islocked()) { - user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %u nick changes in %u seconds", user->nick.c_str(), channel->name.c_str(), f->nicks, f->secs); + user->WriteNumeric(ERR_CANTCHANGENICK, ":%s has been locked for nickchanges for 60 seconds because there have been more than %u nick changes in %u seconds", channel->name.c_str(), f->nicks, f->secs); return MOD_RES_DENY; }