Ver código fonte

Read accounts and grouped nicks in same transaction.

tags/v2.1.0-rc1
Alex Jaspersen 4 anos atrás
pai
commit
b363a01a6f
1 arquivos alterados com 8 adições e 6 exclusões
  1. 8
    6
      irc/accounts.go

+ 8
- 6
irc/accounts.go Ver arquivo

@@ -1050,21 +1050,23 @@ func (am *AccountManager) AuthenticateByPassphrase(client *Client, accountName s
1050 1050
 
1051 1051
 // AllNicks returns the uncasefolded nicknames for all accounts, including additional (grouped) nicks.
1052 1052
 func (am *AccountManager) AllNicks() (result []string) {
1053
-	// Account names
1054 1053
 	accountNamePrefix := fmt.Sprintf(keyAccountName, "")
1054
+	accountAdditionalNicksPrefix := fmt.Sprintf(keyAccountAdditionalNicks, "")
1055
+
1055 1056
 	am.server.store.View(func(tx *buntdb.Tx) error {
1056
-		return tx.AscendGreaterOrEqual("", accountNamePrefix, func(key, value string) bool {
1057
+		// Account names
1058
+		err := tx.AscendGreaterOrEqual("", accountNamePrefix, func(key, value string) bool {
1057 1059
 			if !strings.HasPrefix(key, accountNamePrefix) {
1058 1060
 				return false
1059 1061
 			}
1060 1062
 			result = append(result, value)
1061 1063
 			return true
1062 1064
 		})
1063
-	})
1065
+		if err != nil {
1066
+			return err
1067
+		}
1064 1068
 
1065
-	// Additional nicknames
1066
-	accountAdditionalNicksPrefix := fmt.Sprintf(keyAccountAdditionalNicks, "")
1067
-	am.server.store.View(func(tx *buntdb.Tx) error {
1069
+		// Additional nicks
1068 1070
 		return tx.AscendGreaterOrEqual("", accountAdditionalNicksPrefix, func(key, value string) bool {
1069 1071
 			if !strings.HasPrefix(key, accountAdditionalNicksPrefix) {
1070 1072
 				return false

Carregando…
Cancelar
Salvar