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

strings: Restrict *? explicitly as they are used for mask matching

This commit is contained in:
Daniel Oaks 2016-06-15 17:41:53 +10:00
parent 3a9a643d30
commit fd6ed36995

View File

@ -38,13 +38,16 @@ func (name Name) IsChannel() bool {
func (name Name) IsNickname() bool {
namestr := name.String()
// * is used for unregistered clients
// * is used for mask matching
// ? is used for mask matching
// , is used as a separator by the protocol
// # is a channel prefix
// @+ are channel membership prefixes
// ! 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, "@") {
// # is a channel prefix
// @+ are channel membership prefixes
if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") ||
strings.Contains(namestr, ",") || strings.Contains(namestr, "!") ||
strings.Contains(namestr, "@") || strings.Contains("#@+", string(namestr[0])) {
return false
}
// names that look like hostnames are restricted to servers, as with other ircds