]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
core_whowas Switch from map to a hash map and from irc::string to std::string
[user/henk/code/inspircd.git] / src / users.cpp
index 3c2043ac12aee6fa2654cc30710ff42d3f4a3699..abe0f8804b4f7765281387f2b943741aa6d0cfa5 100644 (file)
@@ -619,7 +619,8 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
                return false;
        }
 
-       if (assign(newnick) == assign(nick))
+       User* const InUse = ServerInstance->FindNickOnly(newnick);
+       if (InUse == this)
        {
                // case change, don't need to check campers
                // and, if it's identical including case, we can leave right now
@@ -638,8 +639,7 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
                 * 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(newnick);
-               if (InUse && (InUse != this))
+               if (InUse)
                {
                        if (InUse->registered != REG_ALL)
                        {
@@ -647,12 +647,8 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
                                InUse->WriteFrom(InUse, "NICK %s", InUse->uuid.c_str());
                                InUse->WriteNumeric(ERR_NICKNAMEINUSE, "%s :Nickname overruled.", InUse->nick.c_str());
 
-                               ServerInstance->Users->clientlist.erase(InUse->nick);
-                               ServerInstance->Users->clientlist[InUse->uuid] = InUse;
-
-                               InUse->nick = InUse->uuid;
-                               InUse->InvalidateCache();
                                InUse->registered &= ~REG_NICK;
+                               InUse->ChangeNick(InUse->uuid);
                        }
                        else
                        {