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

Merge pull request #1241 from slingamn/restricted_stringset

use utils.StringSet in more places
This commit is contained in:
Shivaram Lingamneni 2020-09-05 22:31:17 -07:00 committed by GitHub
commit 60db9536f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 return errAccountCreation
} }
if restrictedCasefoldedNicks[casefoldedAccount] || restrictedSkeletons[skeleton] { if restrictedCasefoldedNicks.Has(casefoldedAccount) || restrictedSkeletons.Has(skeleton) {
return errAccountAlreadyRegistered return errAccountAlreadyRegistered
} }

View File

@ -165,7 +165,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
return "", errNicknameInvalid, false return "", errNicknameInvalid, false
} }
if restrictedCasefoldedNicks[newCfNick] || restrictedSkeletons[newSkeleton] { if restrictedCasefoldedNicks.Has(newCfNick) || restrictedSkeletons.Has(newSkeleton) {
return "", errNicknameInvalid, false return "", errNicknameInvalid, false
} }

View File

@ -23,8 +23,8 @@ var (
"MemoServ", "BotServ", "OperServ", "MemoServ", "BotServ", "OperServ",
} }
restrictedCasefoldedNicks = make(map[string]bool) restrictedCasefoldedNicks = make(utils.StringSet)
restrictedSkeletons = make(map[string]bool) restrictedSkeletons = make(utils.StringSet)
) )
func performNickChange(server *Server, client *Client, target *Client, session *Session, nickname string, rb *ResponseBuffer) error { 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 { if err != nil {
panic(err) panic(err)
} }
restrictedCasefoldedNicks[cfName] = true restrictedCasefoldedNicks.Add(cfName)
skeleton, err := Skeleton(restrictedNickname) skeleton, err := Skeleton(restrictedNickname)
if err != nil { if err != nil {
panic(err) panic(err)
} }
restrictedSkeletons[skeleton] = true restrictedSkeletons.Add(skeleton)
} }
} }