Browse Source

Merge pull request #350 from oragono/unicode-usernames-fix

Set uninteresting username if user's using a special nick
tags/v1.0.0-rc1
Shivaram Lingamneni 5 years ago
parent
commit
8eefe869d0
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      irc/handlers.go

+ 7
- 1
irc/handlers.go View File

@@ -2469,7 +2469,13 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
2469 2469
 
2470 2470
 	err := client.SetNames(msg.Params[0], msg.Params[3], false)
2471 2471
 	if err == errInvalidUsername {
2472
-		rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.t("Malformed username"))
2472
+		// if client's using a unicode nick or something weird, let's just set 'em up with a stock username instead.
2473
+		// fixes clients that just use their nick as a username so they can still use the interesting nick
2474
+		if client.preregNick == msg.Params[0] {
2475
+			client.SetNames("user", msg.Params[3], false)
2476
+		} else {
2477
+			rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.t("Malformed username"))
2478
+		}
2473 2479
 	}
2474 2480
 
2475 2481
 	return false

Loading…
Cancel
Save