3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00
This commit is contained in:
Shivaram Lingamneni 2020-05-17 13:39:37 -04:00
parent 1ab06949bf
commit a397756882
2 changed files with 7 additions and 0 deletions

View File

@ -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]

View File

@ -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()))
}