Mercurial > libervia-backend
changeset 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 | 069abd15354f |
children | 683b76c1145d |
files | src/plugins/plugin_sec_otr.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
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