X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusers.cpp;h=abe0f8804b4f7765281387f2b943741aa6d0cfa5;hb=cf2fd595e08ff181f062bb238aea646ed719d946;hp=3c2043ac12aee6fa2654cc30710ff42d3f4a3699;hpb=393cc8f9d65aefd92628115edae341562ea440e7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/users.cpp b/src/users.cpp index 3c2043ac1..abe0f8804 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -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 {