Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
746:539f278bc265 | 747:5aff0beddb28 |
---|---|
687 jid_ = self.getClientHostJid(profile) | 687 jid_ = self.getClientHostJid(profile) |
688 cache_only = True | 688 cache_only = True |
689 hasServerFeature = lambda entity: entity if self.memory.hasServerFeature(feature, entity, profile) else None | 689 hasServerFeature = lambda entity: entity if self.memory.hasServerFeature(feature, entity, profile) else None |
690 | 690 |
691 def haveItemsFeature(dummy=None): | 691 def haveItemsFeature(dummy=None): |
692 if jid_ in self.memory.server_identities[profile]: | 692 entities = self.memory.getAllServerIdentities(jid_, profile) |
693 for entity in self.memory.server_identities[profile][jid_].values(): | 693 if entities is None: |
694 if hasServerFeature(entity): | 694 return None # no cached data for this server |
695 return entity | 695 for entity in entities: |
696 return None | 696 if hasServerFeature(entity): |
697 return entity | |
698 return None # data are cached but no entity was found | |
697 | 699 |
698 entity = hasServerFeature(jid_) or haveItemsFeature() | 700 entity = hasServerFeature(jid_) or haveItemsFeature() |
699 if entity: | 701 if entity: |
700 return defer.succeed(entity) | 702 return defer.succeed(entity) |
701 elif entity is False or cache_only: | 703 elif entity is False or cache_only: |