]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonicks.cpp
Convert ISUPPORT to use a map instead of a string.
[user/henk/code/inspircd.git] / src / modules / m_nonicks.cpp
index f5c404682d1df7b524630d74035898a8653dd804..c1c1dd13668fd6286f5451bfcd88268a0075f052 100644 (file)
@@ -36,14 +36,14 @@ class ModuleNoNickChange : public Module
  public:
        ModuleNoNickChange() : nn(this)
        {
-               OnRehash(NULL);
-               ServerInstance->Modes->AddMode(&nn);
-               Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
 
-       virtual ~ModuleNoNickChange()
+       void init()
        {
+               OnRehash(NULL);
+               ServerInstance->Modules->AddService(nn);
+               Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        virtual Version GetVersion()
@@ -51,10 +51,9 @@ class ModuleNoNickChange : public Module
                return Version("Provides support for channel mode +N & extban +b N: which prevents nick changes on channel", VF_VENDOR);
        }
 
-
-       virtual void On005Numeric(std::string &output)
+       virtual void On005Numeric(std::map<std::string, std::string>& tokens)
        {
-               ServerInstance->AddExtBanChar('N');
+               tokens["EXTBAN"].push_back('N');
        }
 
        virtual ModResult OnUserPreNick(User* user, const std::string &newnick)
@@ -75,7 +74,7 @@ class ModuleNoNickChange : public Module
                        if (res == MOD_RES_ALLOW)
                                continue;
 
-                       if (override && IS_OPER(user))
+                       if (override && user->IsOper())
                                continue;
 
                        if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N')))
@@ -91,8 +90,7 @@ class ModuleNoNickChange : public Module
 
        virtual void OnRehash(User* user)
        {
-               ConfigReader Conf;
-               override = Conf.ReadFlag("nonicks", "operoverride", "no", 0);
+               override = ServerInstance->Config->ConfValue("nonicks")->getBool("operoverride", false);
        }
 };