mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
fix the rest of #1933
`NICK :` pre-registration needs to be special-cased to immediately send ERR_NONICKNAMEGIVEN (unlike erroneous nonempty nicknames, which are processed when registration is complete)
This commit is contained in:
parent
7201f14b8b
commit
61fd7a2534
@ -2041,14 +2041,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