X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nonicks.cpp;h=998662c3c7e23822e4d0a240e1a7d1c44f88c79a;hb=99af213a58946185621b3e4de01970a7c21cce93;hp=a41f509011ffc51ca712fe74f61aaaffb3001ea6;hpb=6c7a3ceb6c674a9af09da955ee0238e9291cf29a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index a41f50901..998662c3c 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -20,19 +20,16 @@ #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; - bool override; + CheckExemption::EventProvider exemptionprov; + SimpleChannelModeHandler nn; public: - ModuleNoNickChange() : nn(this) + ModuleNoNickChange() + : exemptionprov(this) + , nn(this, "nonick", 'N') { } @@ -46,38 +43,30 @@ 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; - if (override && user->IsOper()) + if (user->HasPrivPermission("channels/ignore-nonicks")) continue; if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn))) { - user->WriteNumeric(ERR_CANTCHANGENICK, ":Can't change nickname while on %s (+N is set)", - 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; } } return MOD_RES_PASSTHRU; } - - void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE - { - override = ServerInstance->Config->ConfValue("nonicks")->getBool("operoverride", false); - } }; MODULE_INIT(ModuleNoNickChange)