|
@@ -2503,12 +2503,18 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
2503
|
2503
|
return false
|
2504
|
2504
|
}
|
2505
|
2505
|
|
2506
|
|
- err := client.SetNames(msg.Params[0], msg.Params[3], false)
|
|
2506
|
+ username, realname := msg.Params[0], msg.Params[3]
|
|
2507
|
+ if len(realname) == 0 {
|
|
2508
|
+ rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), client.t("Not enough parameters"))
|
|
2509
|
+ return false
|
|
2510
|
+ }
|
|
2511
|
+
|
|
2512
|
+ err := client.SetNames(username, realname, false)
|
2507
|
2513
|
if err == errInvalidUsername {
|
2508
|
2514
|
// if client's using a unicode nick or something weird, let's just set 'em up with a stock username instead.
|
2509
|
2515
|
// fixes clients that just use their nick as a username so they can still use the interesting nick
|
2510
|
|
- if client.preregNick == msg.Params[0] {
|
2511
|
|
- client.SetNames("user", msg.Params[3], false)
|
|
2516
|
+ if client.preregNick == username {
|
|
2517
|
+ client.SetNames("user", realname, false)
|
2512
|
2518
|
} else {
|
2513
|
2519
|
rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.Nick(), client.t("Malformed username"))
|
2514
|
2520
|
}
|