From e7ac1ccf4c8a17de98ecd04e80d503d7559e0a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 27 Apr 2019 13:11:02 +0200 Subject: [PATCH] [omemo] Adapt to link handler changes in Gajim --- omemo/file_crypto.py | 7 ++++--- omemo/plugin.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/omemo/file_crypto.py b/omemo/file_crypto.py index a7e6825..6a38867 100644 --- a/omemo/file_crypto.py +++ b/omemo/file_crypto.py @@ -33,6 +33,7 @@ from gi.repository import GLib from gajim.common import app from gajim.common import configpaths +from gajim.common.const import URIType from gajim.plugins.plugins_i18n import _ from gajim.gtk.dialogs import ErrorDialog, YesNoDialog @@ -70,11 +71,11 @@ class FileDecryption: self.plugin = plugin self.window = None - def hyperlink_handler(self, url, kind, instance, window): - if ERROR or kind != 'url': + def hyperlink_handler(self, uri, instance, window): + if ERROR or uri.type != URIType.WEB: return self.window = window - urlparts = urlparse(url) + urlparts = urlparse(uri.data) file = File(urlparts.geturl(), instance.account) if urlparts.scheme not in ['https', 'aesgcm'] or not urlparts.netloc: diff --git a/omemo/plugin.py b/omemo/plugin.py index 40dc694..c7027ff 100644 --- a/omemo/plugin.py +++ b/omemo/plugin.py @@ -211,9 +211,9 @@ class OmemoPlugin(GajimPlugin): return self.get_omemo(account).encrypt_message(conn, obj, callback, False) - def _file_decryption(self, url, kind, instance, window): + def _file_decryption(self, uri, instance, window): file_crypto.FileDecryption(self).hyperlink_handler( - url, kind, instance, window) + uri, instance, window) def encrypt_file(self, file, _account, callback): thread = threading.Thread(target=self._encrypt_file_thread,