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
1 changed files with 2 additions and 3 deletions

View File

@ -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")