diff src/core/sat_main.py @ 747:5aff0beddb28

core: bug fix for requestServerDisco in sat_main.py + added getAllServerIdentities method in memory.py
author souliane <souliane@mailoo.org>
date Mon, 16 Dec 2013 14:35:26 +0100
parents 03744d9ebc13
children a0f4a80a6536
line wrap: on
line diff
--- a/src/core/sat_main.py	Thu Nov 28 19:23:59 2013 +0100
+++ b/src/core/sat_main.py	Mon Dec 16 14:35:26 2013 +0100
@@ -689,11 +689,13 @@
         hasServerFeature = lambda entity: entity if self.memory.hasServerFeature(feature, entity, profile) else None
 
         def haveItemsFeature(dummy=None):
-            if jid_ in self.memory.server_identities[profile]:
-                for entity in self.memory.server_identities[profile][jid_].values():
-                    if hasServerFeature(entity):
-                        return entity
-            return None
+            entities = self.memory.getAllServerIdentities(jid_, profile)
+            if entities is None:
+                return None  # no cached data for this server
+            for entity in entities:
+                if hasServerFeature(entity):
+                    return entity
+            return None  # data are cached but no entity was found
 
         entity = hasServerFeature(jid_) or haveItemsFeature()
         if entity: