mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
use utils.StringSet in more places
This commit is contained in:
parent
c8e2dcb1e9
commit
1dd0c432fd
@ -381,7 +381,7 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
|
||||
return errAccountCreation
|
||||
}
|
||||
|
||||
if restrictedCasefoldedNicks[casefoldedAccount] || restrictedSkeletons[skeleton] {
|
||||
if restrictedCasefoldedNicks.Has(casefoldedAccount) || restrictedSkeletons.Has(skeleton) {
|
||||
return errAccountAlreadyRegistered
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
||||
return "", errNicknameInvalid, false
|
||||
}
|
||||
|
||||
if restrictedCasefoldedNicks[newCfNick] || restrictedSkeletons[newSkeleton] {
|
||||
if restrictedCasefoldedNicks.Has(newCfNick) || restrictedSkeletons.Has(newSkeleton) {
|
||||
return "", errNicknameInvalid, false
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ var (
|
||||
"MemoServ", "BotServ", "OperServ",
|
||||
}
|
||||
|
||||
restrictedCasefoldedNicks = make(map[string]bool)
|
||||
restrictedSkeletons = make(map[string]bool)
|
||||
restrictedCasefoldedNicks = make(utils.StringSet)
|
||||
restrictedSkeletons = make(utils.StringSet)
|
||||
)
|
||||
|
||||
func performNickChange(server *Server, client *Client, target *Client, session *Session, nickname string, rb *ResponseBuffer) error {
|
||||
|
@ -350,11 +350,11 @@ func initializeServices() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
restrictedCasefoldedNicks[cfName] = true
|
||||
restrictedCasefoldedNicks.Add(cfName)
|
||||
skeleton, err := Skeleton(restrictedNickname)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
restrictedSkeletons[skeleton] = true
|
||||
restrictedSkeletons.Add(skeleton)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user