core: server identities are now save in memory

This commit is contained in:
Goffi 2011-04-07 22:21:16 +02:00
commit c665864404

View file

@ -398,6 +398,7 @@ class Memory:
self.history={} #used to store chat history (key: short jid)
self.private={} #used to store private value
self.server_features={} #used to store discovery's informations
self.server_identities={}
host.set_const('savefile_history', SAVEFILE_HISTORY)
host.set_const('savefile_private', SAVEFILE_PRIVATE)
self.load()
@ -545,6 +546,19 @@ class Memory:
if not self.server_features.has_key(profile):
self.server_features[profile] = []
self.server_features[profile].append(feature)
def addServerIdentity(self, category, type, entity, profile):
"""Add an identity discovered from server
@param feature: string of the feature
@param profile: which profile is using this server ?"""
if not self.server_identities.has_key(profile):
self.server_identities[profile] = {}
self.server_identities[profile][(category, type)] = entity
def getServerServiceEntity(self, category, type, profile):
if self.server_identities.has_key(profile):
return self.server_identities[profile].get((category, type))
return None
def hasServerFeature(self, feature, profile_key='@DEFAULT@'):
"""Tell if the server of the profile has the required feature"""