Mercurial > libervia-backend
comparison src/tools/memory.py @ 305:15a12bf2bb62
core: server identities are now save in memory
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 07 Apr 2011 22:21:16 +0200 |
parents | 6a0c6d8e119d |
children | b544bec477dd |
comparison
equal
deleted
inserted
replaced
304:e04ccf122bb6 | 305:15a12bf2bb62 |
---|---|
396 self.subscriptions={} | 396 self.subscriptions={} |
397 self.params=Param(host) | 397 self.params=Param(host) |
398 self.history={} #used to store chat history (key: short jid) | 398 self.history={} #used to store chat history (key: short jid) |
399 self.private={} #used to store private value | 399 self.private={} #used to store private value |
400 self.server_features={} #used to store discovery's informations | 400 self.server_features={} #used to store discovery's informations |
401 self.server_identities={} | |
401 host.set_const('savefile_history', SAVEFILE_HISTORY) | 402 host.set_const('savefile_history', SAVEFILE_HISTORY) |
402 host.set_const('savefile_private', SAVEFILE_PRIVATE) | 403 host.set_const('savefile_private', SAVEFILE_PRIVATE) |
403 self.load() | 404 self.load() |
404 | 405 |
405 def load(self): | 406 def load(self): |
543 @param feature: string of the feature | 544 @param feature: string of the feature |
544 @param profile: which profile is using this server ?""" | 545 @param profile: which profile is using this server ?""" |
545 if not self.server_features.has_key(profile): | 546 if not self.server_features.has_key(profile): |
546 self.server_features[profile] = [] | 547 self.server_features[profile] = [] |
547 self.server_features[profile].append(feature) | 548 self.server_features[profile].append(feature) |
549 | |
550 def addServerIdentity(self, category, type, entity, profile): | |
551 """Add an identity discovered from server | |
552 @param feature: string of the feature | |
553 @param profile: which profile is using this server ?""" | |
554 if not self.server_identities.has_key(profile): | |
555 self.server_identities[profile] = {} | |
556 self.server_identities[profile][(category, type)] = entity | |
557 | |
558 def getServerServiceEntity(self, category, type, profile): | |
559 if self.server_identities.has_key(profile): | |
560 return self.server_identities[profile].get((category, type)) | |
561 return None | |
548 | 562 |
549 def hasServerFeature(self, feature, profile_key='@DEFAULT@'): | 563 def hasServerFeature(self, feature, profile_key='@DEFAULT@'): |
550 """Tell if the server of the profile has the required feature""" | 564 """Tell if the server of the profile has the required feature""" |
551 profile = self.getProfileName(profile_key) | 565 profile = self.getProfileName(profile_key) |
552 if not profile: | 566 if not profile: |