]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nicklock.cpp
The module hook is kinda required.
[user/henk/code/inspircd.git] / src / modules / m_nicklock.cpp
index adeab2691febc35aae7fcbecc612bcf290870d10..d2de094f7602a481f040cc1677603f46a65bc99d 100644 (file)
@@ -48,7 +48,7 @@ class CommandNicklock : public Command
                }
 
                // check nick is valid
-               if (!ServerInstance->IsNick(parameters[1].c_str()))
+               if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
                {
                        return CMD_FAILURE;
                }
@@ -58,8 +58,12 @@ class CommandNicklock : public Command
 
                if (!target->ForceNickChange(parameters[1].c_str()))
                {
-                       // ugh, nickchange failed for some reason -- possibly existing nick? XXX change to UID here
-                       ServerInstance->Users->QuitUser(target, "Nickname collision");
+                       // ugh, nickchange failed for some reason -- possibly existing nick?
+                       if (!target->ForceNickChange(target->uuid.c_str()))
+                       {
+                               // Well shit, we cant even change them to their UID (this should not happen!)
+                               ServerInstance->Users->QuitUser(target, "Nickname collision");
+                       }
                }
 
                // give them a lock flag
@@ -106,7 +110,7 @@ class ModuleNickLock : public Module
        ModuleNickLock(InspIRCd* Me)
                : Module(Me)
        {
-               
+
                cmd1 = new CommandNicklock(ServerInstance);
                cmd2 = new CommandNickunlock(ServerInstance);
                ServerInstance->AddCommand(cmd1);
@@ -114,14 +118,14 @@ class ModuleNickLock : public Module
                Implementation eventlist[] = { I_OnUserPreNick, I_OnUserQuit, I_OnCleanup };
                ServerInstance->Modules->Attach(eventlist, this, 3);
        }
-       
+
        virtual ~ModuleNickLock()
        {
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }