comparison src/tools/memory.py @ 282:6a0c6d8e119d

added plugin xep-0115: entity capabilities
author Goffi <goffi@goffi.org>
date Thu, 03 Feb 2011 01:27:57 +0100
parents a00e87d48213
children 15a12bf2bb62
comparison
equal deleted inserted replaced
281:1e3e169955b2 282:6a0c6d8e119d
395 self.presenceStatus={} 395 self.presenceStatus={}
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 host.set_const('savefile_history', SAVEFILE_HISTORY) 401 host.set_const('savefile_history', SAVEFILE_HISTORY)
401 host.set_const('savefile_private', SAVEFILE_PRIVATE) 402 host.set_const('savefile_private', SAVEFILE_PRIVATE)
402 self.load() 403 self.load()
403 404
404 def load(self): 405 def load(self):
535 @return: value or None if value don't exist""" 536 @return: value or None if value don't exist"""
536 if self.private.has_key(key): 537 if self.private.has_key(key):
537 return self.private[key] 538 return self.private[key]
538 return None 539 return None
539 540
541 def addServerFeature(self, feature, profile):
542 """Add a feature discovered from server
543 @param feature: string of the feature
544 @param profile: which profile is using this server ?"""
545 if not self.server_features.has_key(profile):
546 self.server_features[profile] = []
547 self.server_features[profile].append(feature)
548
549 def hasServerFeature(self, feature, profile_key='@DEFAULT@'):
550 """Tell if the server of the profile has the required feature"""
551 profile = self.getProfileName(profile_key)
552 if not profile:
553 error (_('Trying find server feature for a non-existant profile'))
554 return
555 assert(self.server_features.has_key(profile))
556 return feature in self.server_features[profile]
557
540 558
541 def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'): 559 def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'):
542 debug("Memory addContact: %s",contact_jid.userhost()) 560 debug("Memory addContact: %s",contact_jid.userhost())
543 profile = self.getProfileName(profile_key) 561 profile = self.getProfileName(profile_key)
544 if not profile: 562 if not profile: