]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_nick.cpp
This fixes a deletion error here, we were using new[] and not using delete[], but...
[user/henk/code/inspircd.git] / src / cmd_nick.cpp
index c1638469ec2d4bda69cc7e61e111684178a5efb3..4eb439895f581d8ef8c5c7241b6239ea5fc6b7be 100644 (file)
@@ -12,9 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "configreader.h"
-#include "users.h"
-#include "modules.h"
 #include "xline.h"
 #include "commands/cmd_nick.h"
 
@@ -77,7 +74,6 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
                 * here first, no TS checks need to take place here)
                 */
                userrec* InUse = ServerInstance->FindNickOnly(parameters[0]);
-               ServerInstance->Log(DEBUG,"Nick in use");
                if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0]) || allowinvalid)))
                {
                        if (InUse->registered != REG_ALL)
@@ -94,7 +90,6 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
                        }
                        else
                        {
-                               ServerInstance->Log(DEBUG,"Nick in use and user REG_ALL");
                                user->WriteServ("433 %s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]);
                                return CMD_FAILURE;
                        }
@@ -109,27 +104,25 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
                }
        }
 
-       if (user->registered == REG_ALL)
-       {
-               int MOD_RESULT = 0;
-               FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
-               if (MOD_RESULT) {
-                       // if a module returns true, the nick change is silently forbidden.
-                       return CMD_FAILURE;
-               }
+       int MOD_RESULT = 0;
+       FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
+       if (MOD_RESULT)
+               // if a module returns true, the nick change is silently forbidden.
+               return CMD_FAILURE;
 
+       if (user->registered == REG_ALL)
                user->WriteCommon("NICK %s",parameters[0]);
 
-       }
-
        strlcpy(oldnick, user->nick, NICKMAX - 1);
 
        /* change the nick of the user in the users_hash */
        user = user->UpdateNickHash(parameters[0]);
 
        /* actually change the nick within the record */
-       if (!user) return CMD_FAILURE;
-       if (!*user->nick) return CMD_FAILURE;
+       if (!user)
+               return CMD_FAILURE;
+       if (!*user->nick)
+               return CMD_FAILURE;
 
        strlcpy(user->nick, parameters[0], NICKMAX - 1);