Parcourir la source

fix #1332

tags/v2.4.0-rc1
Shivaram Lingamneni il y a 3 ans
Parent
révision
cf46377863
1 fichiers modifiés avec 15 ajouts et 3 suppressions
  1. 15
    3
      irc/accounts.go

+ 15
- 3
irc/accounts.go Voir le fichier

@@ -268,10 +268,18 @@ func (am *AccountManager) NickToAccount(nick string) string {
268 268
 	if err != nil {
269 269
 		return ""
270 270
 	}
271
+	skel, err := Skeleton(nick)
272
+	if err != nil {
273
+		return ""
274
+	}
271 275
 
272 276
 	am.RLock()
273 277
 	defer am.RUnlock()
274
-	return am.nickToAccount[cfnick]
278
+	account := am.nickToAccount[cfnick]
279
+	if account != "" {
280
+		return account
281
+	}
282
+	return am.skeletonToAccount[skel]
275 283
 }
276 284
 
277 285
 // given an account, combine stored enforcement method with the config settings
@@ -457,7 +465,7 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
457 465
 		defer am.serialCacheUpdateMutex.Unlock()
458 466
 
459 467
 		// can't register an account with the same name as a registered nick
460
-		if am.NickToAccount(casefoldedAccount) != "" {
468
+		if am.NickToAccount(account) != "" {
461 469
 			return errAccountAlreadyRegistered
462 470
 		}
463 471
 
@@ -946,7 +954,11 @@ func (am *AccountManager) SetNickReserved(client *Client, nick string, saUnreser
946 954
 	account := client.Account()
947 955
 	if saUnreserve {
948 956
 		// unless this is a sadrop:
949
-		account = am.NickToAccount(cfnick)
957
+		account := func() string {
958
+			am.RLock()
959
+			defer am.RUnlock()
960
+			return am.nickToAccount[cfnick]
961
+		}()
950 962
 		if account == "" {
951 963
 			// nothing to do
952 964
 			return nil

Chargement…
Annuler
Enregistrer