3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

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

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)