From a39775688281b432dc88c91ef9649f817490b752 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 17 May 2020 13:39:37 -0400 Subject: [PATCH] fix #1019 --- irc/client_lookup_set.go | 5 +++++ irc/nickname.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/irc/client_lookup_set.go b/irc/client_lookup_set.go index 95314509..316738d3 100644 --- a/irc/client_lookup_set.go +++ b/irc/client_lookup_set.go @@ -233,6 +233,11 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick currentClient.SetNames("user", realname, true) // successful reattach! return newNick, nil + } else if currentClient == client && currentClient.Nick() == newNick { + // see #1019: normally no-op nick changes are caught earlier, by performNickChange, + // but they are not detected there when force-guest-format is enabled (because + // the proposed nickname is e.g. alice and the current nickname is Guest-alice) + return "", errNoop } // analogous checks for skeletons skeletonHolder := clients.bySkeleton[newSkeleton] diff --git a/irc/nickname.go b/irc/nickname.go index 793a5895..1adf0f55 100644 --- a/irc/nickname.go +++ b/irc/nickname.go @@ -47,6 +47,8 @@ func performNickChange(server *Server, client *Client, target *Client, session * rb.Add(nil, server.name, ERR_UNKNOWNERROR, currentNick, "NICK", client.t("You must use your account name as your nickname")) } else if err == errNickMissing { rb.Add(nil, server.name, ERR_NONICKNAMEGIVEN, currentNick, client.t("No nickname given")) + } else if err == errNoop { + // no message } else if err != nil { rb.Add(nil, server.name, ERR_UNKNOWNERROR, currentNick, "NICK", fmt.Sprintf(client.t("Could not set or change nickname: %s"), err.Error())) }