comparison src/plugins/plugin_sec_otr.py @ 1657:62cd8fc1aef7

plugin sec_otr: fixes bad handling of entity disconnection
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 10:39:22 +0100
parents 8d61160ee4b8
children d17772b0fe22
comparison
equal deleted inserted replaced
1656:069abd15354f 1657:62cd8fc1aef7
474 474
475 def _presenceReceivedTrigger(self, entity, show, priority, statuses, profile): 475 def _presenceReceivedTrigger(self, entity, show, priority, statuses, profile):
476 if show != C.PRESENCE_UNAVAILABLE: 476 if show != C.PRESENCE_UNAVAILABLE:
477 return True 477 return True
478 if not entity.resource: 478 if not entity.resource:
479 entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored 479 try:
480 otrctx = self.context_managers[profile].getContextForUser(entity) 480 entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored
481 otrctx.disconnect() 481 except exceptions.UnknownEntityError:
482 return True # entity was not connected
483 if entity in self.context_managers[profile].contexts:
484 otrctx = self.context_managers[profile].getContextForUser(entity)
485 otrctx.disconnect()
482 return True 486 return True