X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusers.cpp;h=abe0f8804b4f7765281387f2b943741aa6d0cfa5;hb=cf2fd595e08ff181f062bb238aea646ed719d946;hp=47dbd2d22ac5fe32a37fcd021d4e46dc43b5c621;hpb=bee8625fbe375f55053d3709b72a2972fbf6ba84;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/users.cpp b/src/users.cpp index 47dbd2d22..abe0f8804 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -611,7 +611,7 @@ void User::InvalidateCache() cached_fullrealhost.clear(); } -bool User::ChangeNick(const std::string& newnick, bool force, time_t newts) +bool User::ChangeNick(const std::string& newnick, time_t newts) { if (quitting) { @@ -619,7 +619,8 @@ bool User::ChangeNick(const std::string& newnick, bool force, 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, bool force, 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, bool force, 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 {