mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
commit
5c7df07d91
@ -117,7 +117,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
}
|
}
|
||||||
|
|
||||||
if useAccountName {
|
if useAccountName {
|
||||||
if registered && newNick != accountName && newNick != "" {
|
if registered && newNick != accountName {
|
||||||
return "", errNickAccountMismatch, false
|
return "", errNickAccountMismatch, false
|
||||||
}
|
}
|
||||||
newNick = accountName
|
newNick = accountName
|
||||||
|
@ -2045,14 +2045,22 @@ func namesHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respon
|
|||||||
|
|
||||||
// NICK <nickname>
|
// NICK <nickname>
|
||||||
func nickHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
func nickHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||||
|
newNick := msg.Params[0]
|
||||||
if client.registered {
|
if client.registered {
|
||||||
if client.account == "" && server.Config().Accounts.NickReservation.ForbidAnonNickChanges {
|
if client.account == "" && server.Config().Accounts.NickReservation.ForbidAnonNickChanges {
|
||||||
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), client.t("You may not change your nickname"))
|
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), client.t("You may not change your nickname"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
performNickChange(server, client, client, nil, msg.Params[0], rb)
|
performNickChange(server, client, client, nil, newNick, rb)
|
||||||
} else {
|
} else {
|
||||||
client.preregNick = msg.Params[0]
|
if newNick == "" {
|
||||||
|
// #1933: this would leave (*Client).preregNick at its zero value of "",
|
||||||
|
// which is the same condition as NICK not having been sent yet ---
|
||||||
|
// so we need to send an error immediately
|
||||||
|
rb.Add(nil, server.name, ERR_NONICKNAMEGIVEN, "*", client.t("No nickname given"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
client.preregNick = newNick
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user