mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
Merge pull request #1857 from slingamn/dollarsign
disallow initial $ in nicknames
This commit is contained in:
commit
ac17bf0e9d
@ -97,8 +97,14 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
realname := client.realname
|
realname := client.realname
|
||||||
client.stateMutex.RUnlock()
|
client.stateMutex.RUnlock()
|
||||||
|
|
||||||
if newNick != accountName && strings.ContainsAny(newNick, disfavoredNameCharacters) {
|
// these restrictions have grandfather exceptions for nicknames registered
|
||||||
return "", errNicknameInvalid, false
|
// on previous versions of Ergo:
|
||||||
|
if newNick != accountName {
|
||||||
|
// can't contain "disfavored" characters like <, or start with a $ because
|
||||||
|
// it collides with the massmessage mask syntax:
|
||||||
|
if strings.ContainsAny(newNick, disfavoredNameCharacters) || strings.HasPrefix(newNick, "$") {
|
||||||
|
return "", errNicknameInvalid, false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// recompute always-on status, because client.alwaysOn is not set for unregistered clients
|
// recompute always-on status, because client.alwaysOn is not set for unregistered clients
|
||||||
|
Loading…
Reference in New Issue
Block a user