strings: Nicks and usernames can't contain ! or @

This commit is contained in:
Daniel Oaks 2016-04-21 10:21:36 +10:00
parent 130b9ecb9c
commit 4a8d526c4d
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ func (name Name) IsNickname() bool {
// , is used as a separator by the protocol
// # is a channel prefix
// @+ are channel membership prefixes
if namestr == "*" || strings.Contains(namestr, ",") || strings.Contains("#@+", string(namestr[0])) {
// ! separates username from nickname
// @ separates nick+user from hostname
if namestr == "*" || strings.Contains(namestr, ",") || strings.Contains("#@+", string(namestr[0])) ||
strings.Contains(namestr, "!") || strings.Contains(namestr, "@") {
return false
}
return NicknameExpr.MatchString(namestr)