comparison src/core/sat_main.py @ 917:a9401694d2dc

bridge, frontends: display presence with the highest priority + reset your own presence when you (dis)connect
author souliane <souliane@mailoo.org>
date Thu, 20 Mar 2014 21:18:18 +0100
parents 1a759096ccbd
children ed9841e6d84a
comparison
equal deleted inserted replaced
916:1a759096ccbd 917:a9401694d2dc
572 mess_type=mess_data["type"], 572 mess_type=mess_data["type"],
573 to_jid=mess_data['xml']['to'], 573 to_jid=mess_data['xml']['to'],
574 extra=mess_data['extra'], 574 extra=mess_data['extra'],
575 profile=profile) 575 profile=profile)
576 576
577 def _setPresence(self, to="", show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE): 577 def _setPresence(self, to="", show="", statuses=None, profile_key=C.PROF_KEY_NONE):
578 return self.setPresence(jid.JID(to) if to else None, show, priority, statuses, profile_key) 578 return self.setPresence(jid.JID(to) if to else None, show, statuses, profile_key)
579 579
580 def setPresence(self, to_jid=None, show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE): 580 def setPresence(self, to_jid=None, show="", statuses=None, profile_key=C.PROF_KEY_NONE):
581 """Send our presence information""" 581 """Send our presence information"""
582 if statuses is None: 582 if statuses is None:
583 statuses = {} 583 statuses = {}
584 profile = self.memory.getProfileName(profile_key) 584 profile = self.memory.getProfileName(profile_key)
585 assert(profile) 585 assert(profile)
586 priority = int(self.memory.getParamA("Priority", "Connection", profile_key=profile))
586 self.profiles[profile].presence.available(to_jid, show, statuses, priority) 587 self.profiles[profile].presence.available(to_jid, show, statuses, priority)
587 #XXX: FIXME: temporary fix to work around openfire 3.7.0 bug (presence is not broadcasted to generating resource) 588 #XXX: FIXME: temporary fix to work around openfire 3.7.0 bug (presence is not broadcasted to generating resource)
588 if '' in statuses: 589 if '' in statuses:
589 statuses['default'] = statuses[''] 590 statuses['default'] = statuses['']
590 del statuses[''] 591 del statuses['']