]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_nick.cpp
Read multiple GnuTLS records in one RawSocketRead operation
[user/henk/code/inspircd.git] / src / commands / cmd_nick.cpp
index 4621a0a291c97343a675ab5b66e064283e102ee3..a926913753673dff7071090773cae9baac6b9525 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -183,19 +183,20 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
        if (user->registered < REG_NICKUSER)
        {
                user->registered = (user->registered | REG_NICK);
-       }
-
-       // Keep these seperate!
+               if (user->registered == REG_NICKUSER)
+               {
+                       /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
+                       MOD_RESULT = 0;
+                       FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
+                       if (MOD_RESULT > 0)
+                               return CMD_FAILURE;
 
-       if (user->registered == REG_NICKUSER)
-       {
-               /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
-               MOD_RESULT = 0;
-               FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
-               if (MOD_RESULT > 0)
-                       return CMD_FAILURE;
+                       // return early to not penalize new users
+                       return CMD_SUCCESS;
+               }
        }
-       else if (user->registered == REG_ALL)
+
+       if (user->registered == REG_ALL)
        {
                user->IncreasePenalty(10);
                FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user, oldnick));