added plugin xep-0115: entity capabilities
This commit is contained in:
parent
9a6a3c08f1
commit
72e279c1f7
1 changed files with 227 additions and 7 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue