mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 20:09:41 +01:00
fix a fairly bad bug where nicks could get out of sync
during nick change, removeInternal(client) was being called even before checking whether the new nick was in use or reserved. Reproduction steps: 1. Log in a client 'alice' 2. Log in a client 'bob' 3. bob issues /nick alice, which fails (correctly) with: :oragono.test 433 bob alice :Nickname is already in use 4. alice issues /msg bob hi, which fails (incorrectly) with: :oragono.test 401 alice bob :No such nick
This commit is contained in:
parent
9a2117f75d
commit
d0ded906d4
@ -129,7 +129,6 @@ func (clients *ClientManager) SetNick(client *Client, newNick string) error {
|
||||
clients.Lock()
|
||||
defer clients.Unlock()
|
||||
|
||||
clients.removeInternal(client)
|
||||
currentNewEntry := clients.byNick[newcfnick]
|
||||
// the client may just be changing case
|
||||
if currentNewEntry != nil && currentNewEntry != client {
|
||||
@ -138,6 +137,7 @@ func (clients *ClientManager) SetNick(client *Client, newNick string) error {
|
||||
if method == NickReservationStrict && reservedAccount != client.Account() {
|
||||
return errNicknameReserved
|
||||
}
|
||||
clients.removeInternal(client)
|
||||
clients.byNick[newcfnick] = client
|
||||
client.updateNickMask(newNick)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user