plugin sec_otr: fixes bad handling of entity disconnection

This commit is contained in:
souliane 2015-11-24 10:39:22 +01:00
commit 288f6aa100

View file

@ -476,7 +476,11 @@ class OTR(object):
if show != C.PRESENCE_UNAVAILABLE:
return True
if not entity.resource:
entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored
otrctx = self.context_managers[profile].getContextForUser(entity)
otrctx.disconnect()
try:
entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored
except exceptions.UnknownEntityError:
return True # entity was not connected
if entity in self.context_managers[profile].contexts:
otrctx = self.context_managers[profile].getContextForUser(entity)
otrctx.disconnect()
return True