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

use utils.StringSet in more places

This commit is contained in:
Shivaram Lingamneni 2020-08-22 22:43:21 -04:00
parent c8e2dcb1e9
commit 1dd0c432fd
4 changed files with 6 additions and 6 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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)
}
}