mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
strings: Restrict *? explicitly as they are used for mask matching
This commit is contained in:
parent
3a9a643d30
commit
fd6ed36995
@ -38,13 +38,16 @@ func (name Name) IsChannel() bool {
|
|||||||
func (name Name) IsNickname() bool {
|
func (name Name) IsNickname() bool {
|
||||||
namestr := name.String()
|
namestr := name.String()
|
||||||
// * is used for unregistered clients
|
// * is used for unregistered clients
|
||||||
|
// * is used for mask matching
|
||||||
|
// ? is used for mask matching
|
||||||
// , is used as a separator by the protocol
|
// , is used as a separator by the protocol
|
||||||
// # is a channel prefix
|
|
||||||
// @+ are channel membership prefixes
|
|
||||||
// ! separates username from nickname
|
// ! separates username from nickname
|
||||||
// @ separates nick+user from hostname
|
// @ separates nick+user from hostname
|
||||||
if namestr == "*" || strings.Contains(namestr, ",") || strings.Contains("#@+", string(namestr[0])) ||
|
// # is a channel prefix
|
||||||
strings.Contains(namestr, "!") || strings.Contains(namestr, "@") {
|
// @+ 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
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user