added plugin xep-0115: entity capabilities

This commit is contained in:
Goffi 2011-02-03 01:27:57 +01:00
commit 72e279c1f7

View file

@ -397,6 +397,7 @@ class Memory:
self.params=Param(host)
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
host.set_const('savefile_history', SAVEFILE_HISTORY)
host.set_const('savefile_private', SAVEFILE_PRIVATE)
self.load()
@ -537,6 +538,23 @@ class Memory:
return self.private[key]
return None
def addServerFeature(self, feature, profile):
"""Add a feature discovered from server
@param feature: string of the feature
@param profile: which profile is using this server ?"""
if not self.server_features.has_key(profile):
self.server_features[profile] = []
self.server_features[profile].append(feature)
def hasServerFeature(self, feature, profile_key='@DEFAULT@'):
"""Tell if the server of the profile has the required feature"""
profile = self.getProfileName(profile_key)
if not profile:
error (_('Trying find server feature for a non-existant profile'))
return
assert(self.server_features.has_key(profile))
return feature in self.server_features[profile]
def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'):
debug("Memory addContact: %s",contact_jid.userhost())