Mercurial > libervia-backend
diff 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 |
line wrap: on
line diff
--- a/src/plugins/plugin_sec_otr.py Mon Nov 23 23:30:41 2015 +0100 +++ b/src/plugins/plugin_sec_otr.py Tue Nov 24 10:39:22 2015 +0100 @@ -476,7 +476,11 @@ 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