summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-08-25 00:48:57 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-12-27 18:58:48 +0100
commit03499a2d2c0a657a886913d3988d69ca08ceca3a (patch)
treee11b5c318594adbb8036ad7a5c68a6d69197a078 /plugins
parent0e27485c36de12bb4831e2a48c63a3a4e56d3da6 (diff)
downloadpoezio-03499a2d2c0a657a886913d3988d69ca08ceca3a.tar.gz
poezio-03499a2d2c0a657a886913d3988d69ca08ceca3a.tar.bz2
poezio-03499a2d2c0a657a886913d3988d69ca08ceca3a.tar.xz
poezio-03499a2d2c0a657a886913d3988d69ca08ceca3a.zip
omemo: handle MissingBundleException when it comes from EncryptionPrepareException
We're not supposed to see MissingBundleException directly as it's handled by slixmpp-omemo. Slixmpp-omemo will give us all the remaining exceptions via EncryptionPrepareException when it doesn't know what to do anymore. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo_plugin.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/omemo_plugin.py b/plugins/omemo_plugin.py
index 6efa8c08..538be98e 100644
--- a/plugins/omemo_plugin.py
+++ b/plugins/omemo_plugin.py
@@ -18,6 +18,7 @@ from poezio.xdg import DATA_HOME
from poezio.tabs import DynamicConversationTab, StaticConversationTab, MucTab
from omemo.exceptions import MissingBundleException
+from slixmpp import JID
from slixmpp.stanza import Message
from slixmpp.exceptions import IqError, IqTimeout
from slixmpp_omemo import PluginCouldNotLoad, MissingOwnKey, NoAvailableSession
@@ -143,13 +144,18 @@ class Plugin(E2EEPlugin):
# This is where you prompt your user to ask what to do. In
# this bot we will automatically trust undecided recipients.
self.core.xmpp['xep_0384'].trust(exn.bare_jid, exn.device, exn.ik)
- except MissingBundleException as exn:
- self.display_error(
- 'Could not find keys for device "%d" of recipient "%s". Skipping.' % (exn.device, exn.bare_jid),
- )
- device_list = expect_problems.setdefault(exn.bare_jid, [])
- device_list.append(exn.device)
# TODO: catch NoEligibleDevicesException
+ except EncryptionPrepareException as exn:
+ log.debug('FOO: EncryptionPrepareException: %r', exn.errors)
+ for error in exn.errors:
+ if isinstance(error, MissingBundleException):
+ self.display_error(
+ 'Could not find keys for device "%d" of recipient "%s". Skipping.' %
+ (error.device, error.bare_jid),
+ )
+ jid = JID(error.bare_jid)
+ device_list = expect_problems.setdefault(jid, [])
+ device_list.append(error.device)
except (IqError, IqTimeout) as exn:
self.display_error(
'An error occured while fetching information on a recipient.\n%r' % exn,