From 8ecf96d447025f20827ef8f2b375873b2a52564e Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Wed, 6 Feb 2019 08:33:15 +1000 Subject: [PATCH] Set uninteresting username if user's using a special nick --- irc/handlers.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/irc/handlers.go b/irc/handlers.go index e2d8f278..b38c7f06 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2469,7 +2469,13 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp err := client.SetNames(msg.Params[0], msg.Params[3], false) if err == errInvalidUsername { - rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.t("Malformed username")) + // if client's using a unicode nick or something weird, let's just set 'em up with a blank username instead. + // fixes clients that just use their nick as a username so they can still use the interesting nick + if client.preregNick != "" && !isIdent(client.preregNick) { + client.SetNames("user", msg.Params[3], false) + } else { + rb.Add(nil, server.name, ERR_INVALIDUSERNAME, client.t("Malformed username")) + } } return false