From 3016635f6a6bd23e34461e93cef3e8d861ce4275 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 28 Sep 2015 11:38:32 +0300 Subject: [PATCH] HasPrefix is not necessary before TrimPrefix --- daemon.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/daemon.go b/daemon.go index 7af810c..53dde3e 100644 --- a/daemon.go +++ b/daemon.go @@ -180,9 +180,8 @@ func (daemon *Daemon) ClientRegister(client *Client, command string, cols []stri return } nickname := cols[1] - if (strings.HasPrefix(nickname, ":")) { - nickname = strings.TrimPrefix(nickname, ":") - } + // Compatibility with some clients prepending colons to nickname + nickname = strings.TrimPrefix(nickname, ":") for existingClient := range daemon.clients { if existingClient.nickname == nickname { client.ReplyParts("433", "*", nickname, "Nickname is already in use")