diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-26 03:43:59 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-26 03:43:59 +0000 |
commit | e33e7a055eba9cd7b989c152b171fd98465ee28f (patch) | |
tree | 44455e127686a040bf92d6b81e72f7b2fb201ddd | |
parent | bff68688367b82f9841d6c45114c58af61a800e8 (diff) |
Fix OnUserRegister being triggered twice if someone sent a NICK while waiting on an ident timeout
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11329 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/commands/cmd_nick.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index ff7498ea2..a92691375 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -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)); |