HasPrefix is not necessary before TrimPrefix

This commit is contained in:
Sergey Matveev 2015-09-28 11:38:32 +03:00
parent 43fccdbbae
commit 3016635f6a

View File

@ -180,9 +180,8 @@ func (daemon *Daemon) ClientRegister(client *Client, command string, cols []stri
return return
} }
nickname := cols[1] nickname := cols[1]
if (strings.HasPrefix(nickname, ":")) { // Compatibility with some clients prepending colons to nickname
nickname = strings.TrimPrefix(nickname, ":") nickname = strings.TrimPrefix(nickname, ":")
}
for existingClient := range daemon.clients { for existingClient := range daemon.clients {
if existingClient.nickname == nickname { if existingClient.nickname == nickname {
client.ReplyParts("433", "*", nickname, "Nickname is already in use") client.ReplyParts("433", "*", nickname, "Nickname is already in use")