3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 11:59:40 +01:00

Merge pull request #1022 from slingamn/issue1019_snomask

fix #1019
This commit is contained in:
Shivaram Lingamneni 2020-05-18 00:57:25 -07:00 committed by GitHub
commit b9a2cbb08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()))
}