diff --git a/poezio_plugins/omemo/__init__.py b/poezio_plugins/omemo/__init__.py index 2ba9c2b..24acfc9 100644 --- a/poezio_plugins/omemo/__init__.py +++ b/poezio_plugins/omemo/__init__.py @@ -94,13 +94,18 @@ class Plugin(E2EEPlugin): if trust is not None ] - def decrypt(self, message: Message, tab, allow_untrusted=False) -> None: + def decrypt(self, message: Message, tab) -> None: body = None try: mfrom = message['from'] encrypted = message['omemo_encrypted'] - body = self.core.xmpp['xep_0384'].decrypt_message(encrypted, mfrom, allow_untrusted) + body = self.core.xmpp['xep_0384'].decrypt_message( + encrypted, + mfrom, + # Always decrypt. Let us handle how we then warn the user. + allow_untrusted=True, + ) body = body.decode('utf-8') except (MissingOwnKey,): # The message is missing our own key, it was not encrypted for @@ -119,20 +124,6 @@ class Plugin(E2EEPlugin): 'I can\'t decrypt this message as it uses an encrypted ' 'session I don\'t know about.', ) - except (UndecidedException, UntrustedException) as exn: - # We received a message from an untrusted device. We can - # choose to decrypt the message nonetheless, with the - # `allow_untrusted` flag on the `decrypt_message` call, which - # we will do here. This is only possible for decryption, - # encryption will require us to decide if we trust the device - # or not. Clients _should_ indicate that the message was not - # trusted, or in undecided state, if they decide to decrypt it - # anyway. - self.display_error( - "Your device '%s' is not in my trusted devices." % exn.device, - ) - # We resend, setting the `allow_untrusted` parameter to True. - self.decrypt(message, tab, allow_untrusted=True) except (EncryptionPrepareException,): # Slixmpp tried its best, but there were errors it couldn't # resolve. At this point you should have seen other exceptions