]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nicklock.cpp
Convert WriteNumeric() calls to pass the parameters of the numeric as method parameters
[user/henk/code/inspircd.git] / src / modules / m_nicklock.cpp
index b8d4ac4df3682c8bb1d6c951575070fc0281a86e..634982d14dc72a8d226a8674098362633cd91125 100644 (file)
@@ -55,7 +55,7 @@ class CommandNicklock : public Command
                                return CMD_FAILURE;
                        }
 
-                       user->WriteNumeric(947, "%s :Nickname now locked.", parameters[1].c_str());
+                       user->WriteNumeric(947, parameters[1], "Nickname now locked.");
                }
 
                /* If we made it this far, extend the user */
@@ -64,7 +64,7 @@ class CommandNicklock : public Command
                        locked.set(target, 1);
 
                        std::string oldnick = target->nick;
-                       if (target->ForceNickChange(parameters[1]))
+                       if (target->ChangeNick(parameters[1]))
                                ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used NICKLOCK to change and hold "+oldnick+" to "+parameters[1]);
                        else
                        {
@@ -144,7 +144,9 @@ class ModuleNickLock : public Module
        CommandNickunlock cmd2;
  public:
        ModuleNickLock()
-               : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked)
+               : locked("nick_locked", ExtensionItem::EXT_USER, this)
+               , cmd1(this, locked)
+               , cmd2(this, locked)
        {
        }
 
@@ -153,14 +155,11 @@ class ModuleNickLock : public Module
                return Version("Provides the NICKLOCK command, allows an oper to change a users nick and lock them to it until they quit", VF_OPTCOMMON | VF_VENDOR);
        }
 
-       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;
-
                if (locked.get(user))
                {
-                       user->WriteNumeric(ERR_CANTCHANGENICK, ":You cannot change your nickname (your nick is locked)");
+                       user->WriteNumeric(ERR_CANTCHANGENICK, "You cannot change your nickname (your nick is locked)");
                        return MOD_RES_DENY;
                }
                return MOD_RES_PASSTHRU;
@@ -169,7 +168,7 @@ class ModuleNickLock : public Module
        void Prioritize()
        {
                Module *nflood = ServerInstance->Modules->Find("m_nickflood.so");
-               ServerInstance->Modules->SetPriority(this, I_OnUserPreNick, PRIORITY_BEFORE, &nflood);
+               ServerInstance->Modules->SetPriority(this, I_OnUserPreNick, PRIORITY_BEFORE, nflood);
        }
 };