diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-09-15 21:41:00 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-09-15 21:41:00 +0300 |
commit | 7873f0aee9724b57c4c5ba97702f275c37bb2d56 (patch) | |
tree | 0baa17a22f7220cb560723795a0619dd5036e61d /omemo | |
parent | 07a818901f7596bdbe1b0c3ac6c069f8fb6bfb64 (diff) |
[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
Diffstat (limited to 'omemo')
-rw-r--r-- | omemo/omemo/state.py | 10 |
1 files 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:
|