diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-09-15 21:59:26 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-09-15 21:59:26 +0300 |
commit | 2cadb609f6aa6220feb34a97b180799c86de632c (patch) | |
tree | 3203bf4ed9e5e8ba83e25f10d13862961bc69a18 | |
parent | 54b1b0e62c8283370fa3e8c409e9427c29e5ae17 (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
-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 91cd319..4b3d633 100644 --- a/omemo/omemo/state.py +++ b/omemo/omemo/state.py @@ -299,6 +299,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: @@ -359,8 +361,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: |