Browse Source

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

tags/v0.1.0
Daniel Oaks 8 years ago
parent
commit
9d853d5be7
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      irc/strings.go

+ 3
- 1
irc/strings.go View File

52
 	// @ separates nick+user from hostname
52
 	// @ separates nick+user from hostname
53
 	// # is a channel prefix
53
 	// # is a channel prefix
54
 	// @+ are channel membership prefixes
54
 	// @+ are channel membership prefixes
55
+	// - is typically disallowed from first char of nicknames
56
+	// nicknames can't start with digits
55
 	if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") ||
57
 	if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") ||
56
 		strings.Contains(namestr, ",") || strings.Contains(namestr, "!") ||
58
 		strings.Contains(namestr, ",") || strings.Contains(namestr, "!") ||
57
-		strings.Contains(namestr, "@") || strings.Contains("#@+", string(namestr[0])) {
59
+		strings.Contains(namestr, "@") || strings.Contains("#@+-1234567890", string(namestr[0])) {
58
 		return false
60
 		return false
59
 	}
61
 	}
60
 	// names that look like hostnames are restricted to servers, as with other ircds
62
 	// names that look like hostnames are restricted to servers, as with other ircds

Loading…
Cancel
Save