From 7873f0aee9724b57c4c5ba97702f275c37bb2d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Fri, 15 Sep 2017 20:41:00 +0200 Subject: [PATCH] [omemo] Fix sending messages to a room fail We would receive a KeyError for jids we dont have in the roster, now we skip them and print a warning. Fixes #173 --- omemo/omemo/state.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/omemo/omemo/state.py b/omemo/omemo/state.py index 9493b21..75dbf41 100644 --- a/omemo/omemo/state.py +++ b/omemo/omemo/state.py @@ -308,6 +308,8 @@ class OmemoState: continue if jid_to in encrypted_jids: # We already encrypted to this JID continue + if jid_to not in self.session_ciphers: + continue for rid, cipher in self.session_ciphers[jid_to].items(): try: if self.isTrusted(jid_to, rid) == TRUSTED: @@ -368,8 +370,12 @@ class OmemoState: jid_to = self.plugin.groupchat[room][nick] if jid_to == self.own_jid: continue - for device in self.device_ids[jid_to]: - devicelist.append((jid_to, device)) + try: + for device in self.device_ids[jid_to]: + devicelist.append((jid_to, device)) + except KeyError: + log.warning('no device ids found for %s', jid_to) + continue return devicelist if jid == self.own_jid: -- GitLab