]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonicks.cpp
Some more text fixes and improvements (#1618).
[user/henk/code/inspircd.git] / src / modules / m_nonicks.cpp
index d4da3e95139b251dc5f8b7add2321d5c55579c6c..a796495a81d95a0b6e72fb883a85a8efe996251c 100644 (file)
 
 
 #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')
        {
        }
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides support for channel mode +N & extban +b N: which prevents nick changes on channel", VF_VENDOR);
+               return Version("Provides channel mode +N and extban 'N' which prevents nick changes on the channel", VF_VENDOR);
        }
 
        void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
@@ -52,17 +49,17 @@ class ModuleNoNickChange : public Module
                {
                        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, InspIRCd::Format("Can't change nickname while on %s (+N is set)",
+                               user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (+N is set)",
                                        curr->name.c_str()));
                                return MOD_RES_DENY;
                        }
@@ -70,11 +67,6 @@ class ModuleNoNickChange : public Module
 
                return MOD_RES_PASSTHRU;
        }
-
-       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
-       {
-               override = ServerInstance->Config->ConfValue("nonicks")->getBool("operoverride", false);
-       }
 };
 
 MODULE_INIT(ModuleNoNickChange)