diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-21 20:27:44 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-21 20:27:44 +0000 |
commit | 496a38c28c2077b7d9ffcda88b65069c615d7d57 (patch) | |
tree | 222c6269e1a36061cf6f86f5a1c6d52e8bb63747 /src/cmd_nick.cpp | |
parent | 665ae74f2a8be8f9fd6592cd8f1655d3ad65a3dd (diff) |
Update/clarify a comment a bit
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8281 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cmd_nick.cpp')
-rw-r--r-- | src/cmd_nick.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 218ea23f2..976c78a7d 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -67,29 +67,32 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, User *user) user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason); return CMD_FAILURE; } - /* Check for nickname overruled - - * This happens when one user has connected and sent only NICK, and is essentially - * "camping" upon a nickname. To give the new user connecting a fair chance of having - * the nickname too, we force a nickchange on the older user (Simply the one who was - * here first, no TS checks need to take place here) + + /* + * Uh oh.. if the nickname is in use, and it's not in use by the person using it (doh) -- + * then we have a potential collide. Check whether someone else is camping on the nick + * (i.e. connect -> send NICK, don't send USER.) If they are camping, force-change the + * camper to their UID, and allow the incoming nick change. + * + * If the guy using the nick is already using it, tell the incoming nick change to gtfo, + * because the nick is already (rightfully) in use. -- w00t */ User* InUse = ServerInstance->FindNickOnly(parameters[0]); if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0]) || allowinvalid))) { if (InUse->registered != REG_ALL) { - /* change the nick of the older user to its UUID - */ + /* force the camper to their UUID, and ask them to re-send a NICK. */ InUse->WriteTo(InUse, "NICK %s", InUse->uuid); InUse->WriteServ("433 %s %s :Nickname overruled.", InUse->nick, InUse->nick); InUse->UpdateNickHash(InUse->uuid); strlcpy(InUse->nick, InUse->uuid, NICKMAX - 1); InUse->InvalidateCache(); - /* Take away their nickname-sent state forcing them to send a nick again */ InUse->registered &= ~REG_NICK; } else { + /* No camping, tell the incoming user to stop trying to change nick ;p */ user->WriteServ("433 %s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]); return CMD_FAILURE; } |