X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nonicks.cpp;h=c82107be8c5e4d8ac88c8305238a5093cad151e2;hb=12a47e788b3eba8e395abdd46c2dc91692b9b292;hp=3ae54f2ebc64c23c33df6a4ef2d323bbc30eeb26;hpb=992674362c5f64bdb8e1942eeaa7612524529cd6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 3ae54f2eb..c82107be8 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -20,19 +20,17 @@ #include "inspircd.h" - -class NoNicks : public SimpleChannelModeHandler -{ - public: - NoNicks(Module* Creator) : SimpleChannelModeHandler(Creator, "nonick", 'N') { } -}; +#include "modules/exemption.h" class ModuleNoNickChange : public Module { - NoNicks nn; + CheckExemption::EventProvider exemptionprov; + SimpleChannelModeHandler nn; bool override; public: - ModuleNoNickChange() : nn(this) + ModuleNoNickChange() + : exemptionprov(this) + , nn(this, "nonick", 'N') { } @@ -46,16 +44,13 @@ class ModuleNoNickChange : public Module tokens["EXTBAN"].push_back('N'); } - ModResult OnUserPreNick(User* user, const std::string &newnick) CXX11_OVERRIDE + ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE { - if (!IS_LOCAL(user)) - return MOD_RES_PASSTHRU; - - for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) + for (User::ChanList::iterator i = user->chans.begin(); i != user->chans.end(); i++) { - Channel* curr = *i; + Channel* curr = (*i)->chan; - ModResult res = ServerInstance->OnCheckExemption(user,curr,"nonick"); + ModResult res = CheckExemption::Call(exemptionprov, user, curr, "nonick"); if (res == MOD_RES_ALLOW) continue; @@ -65,8 +60,8 @@ class ModuleNoNickChange : public Module if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn))) { - user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)", - user->nick.c_str(), curr->name.c_str()); + user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (+N is set)", + curr->name.c_str())); return MOD_RES_DENY; } }