3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 13:59:44 +01:00

strings: Don't allow nicks to start with dashes or 0-9

This commit is contained in:
Daniel Oaks 2016-08-12 23:33:44 +10:00
parent 5e55e35774
commit 9d853d5be7

View File

@ -52,9 +52,11 @@ func (name Name) IsNickname() bool {
// @ separates nick+user from hostname // @ separates nick+user from hostname
// # is a channel prefix // # is a channel prefix
// @+ are channel membership prefixes // @+ are channel membership prefixes
// - is typically disallowed from first char of nicknames
// nicknames can't start with digits
if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") || if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") ||
strings.Contains(namestr, ",") || strings.Contains(namestr, "!") || strings.Contains(namestr, ",") || strings.Contains(namestr, "!") ||
strings.Contains(namestr, "@") || strings.Contains("#@+", string(namestr[0])) { strings.Contains(namestr, "@") || strings.Contains("#@+-1234567890", string(namestr[0])) {
return false return false
} }
// names that look like hostnames are restricted to servers, as with other ircds // names that look like hostnames are restricted to servers, as with other ircds