mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 21:39:25 +01:00
fix #1057
This commit is contained in:
parent
29165ded62
commit
6aa9a56242
@ -2503,12 +2503,18 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
||||
return false
|
||||
}
|
||||
|
||||
err := client.SetNames(msg.Params[0], msg.Params[3], false)
|
||||
username, realname := msg.Params[0], msg.Params[3]
|
||||
if len(realname) == 0 {
|
||||
rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), client.t("Not enough parameters"))
|
||||
return false
|
||||
}
|
||||
|
||||
err := client.SetNames(username, realname, false)
|
||||
if err == errInvalidUsername {
|
||||
// if client's using a unicode nick or something weird, let's just set 'em up with a stock username instead.
|
||||
// fixes clients that just use their nick as a username so they can still use the interesting nick
|
||||
if client.preregNick == msg.Params[0] {
|
||||
client.SetNames("user", msg.Params[3], false)
|
||||
if client.preregNick == username {
|
||||
client.SetNames("user", realname, false)
|
||||
} else {
|
||||
rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.Nick(), client.t("Malformed username"))
|
||||
}
|
||||
|
@ -206,7 +206,9 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
|
||||
}
|
||||
|
||||
// try to complete registration normally
|
||||
if c.preregNick == "" || !c.HasUsername() || session.capState == caps.NegotiatingState {
|
||||
// XXX(#1057) username can be filled in by an ident query without the client
|
||||
// having sent USER: check for both username and realname to ensure they did
|
||||
if c.preregNick == "" || c.username == "" || c.realname == "" || session.capState == caps.NegotiatingState {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user