mirror of
https://github.com/ergochat/ergo.git
synced 2025-02-01 23:24:09 +01:00
fix #1332
This commit is contained in:
parent
c639aac241
commit
cf46377863
@ -268,10 +268,18 @@ func (am *AccountManager) NickToAccount(nick string) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
skel, err := Skeleton(nick)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
am.RLock()
|
am.RLock()
|
||||||
defer am.RUnlock()
|
defer am.RUnlock()
|
||||||
return am.nickToAccount[cfnick]
|
account := am.nickToAccount[cfnick]
|
||||||
|
if account != "" {
|
||||||
|
return account
|
||||||
|
}
|
||||||
|
return am.skeletonToAccount[skel]
|
||||||
}
|
}
|
||||||
|
|
||||||
// given an account, combine stored enforcement method with the config settings
|
// given an account, combine stored enforcement method with the config settings
|
||||||
@ -457,7 +465,7 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
|
|||||||
defer am.serialCacheUpdateMutex.Unlock()
|
defer am.serialCacheUpdateMutex.Unlock()
|
||||||
|
|
||||||
// can't register an account with the same name as a registered nick
|
// can't register an account with the same name as a registered nick
|
||||||
if am.NickToAccount(casefoldedAccount) != "" {
|
if am.NickToAccount(account) != "" {
|
||||||
return errAccountAlreadyRegistered
|
return errAccountAlreadyRegistered
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -946,7 +954,11 @@ func (am *AccountManager) SetNickReserved(client *Client, nick string, saUnreser
|
|||||||
account := client.Account()
|
account := client.Account()
|
||||||
if saUnreserve {
|
if saUnreserve {
|
||||||
// unless this is a sadrop:
|
// unless this is a sadrop:
|
||||||
account = am.NickToAccount(cfnick)
|
account := func() string {
|
||||||
|
am.RLock()
|
||||||
|
defer am.RUnlock()
|
||||||
|
return am.nickToAccount[cfnick]
|
||||||
|
}()
|
||||||
if account == "" {
|
if account == "" {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user