diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-20 15:02:45 +0900 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-11-26 16:34:58 +0000 |
commit | 76445a68670b8b1cc9a046d582ddc68982e4c221 (patch) | |
tree | 79ca7e397a397d8fbf513491125414e16ec3e549 | |
parent | 1f43535f459ca5445dc0a8bfa05d57ac20481cad (diff) | |
download | poezio-76445a68670b8b1cc9a046d582ddc68982e4c221.tar.gz poezio-76445a68670b8b1cc9a046d582ddc68982e4c221.tar.bz2 poezio-76445a68670b8b1cc9a046d582ddc68982e4c221.tar.xz poezio-76445a68670b8b1cc9a046d582ddc68982e4c221.zip |
Add support for XEP-0380: Explicit Message Encryption
Both for displaying incoming messages, and sending OTR and legacy
OpenPGP.
-rw-r--r-- | plugins/gpg/__init__.py | 1 | ||||
-rw-r--r-- | plugins/otr.py | 1 | ||||
-rw-r--r-- | poezio/connection.py | 1 | ||||
-rw-r--r-- | poezio/core/handlers.py | 5 |
4 files changed, 7 insertions, 1 deletions
diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py index 128cd1d1..daf76e65 100644 --- a/plugins/gpg/__init__.py +++ b/plugins/gpg/__init__.py @@ -251,6 +251,7 @@ class Plugin(BasePlugin): encrypted_element.text = self.remove_gpg_headers(xml.sax.saxutils.escape(str(text))) message.append(encrypted_element) message['body'] = 'This message has been encrypted using the GPG key with id: %s' % self.keyid + message['eme']['namespace'] = 'jabber:x:encrypted' message.send() del message['body'] tab.add_message(body, nickname=self.core.own_nick, diff --git a/plugins/otr.py b/plugins/otr.py index cffe1797..580a72c4 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -347,6 +347,7 @@ class PoezioContext(Context): message = self.xmpp.make_message(mto=self.peer, mbody=msg.decode('ascii'), mtype='chat') + message['eme']['namespace'] = 'urn:xmpp:otr:0' message.enable('carbon_private') message.enable('no-copy') message.enable('no-permanent-store') diff --git a/poezio/connection.py b/poezio/connection.py index be030497..b20b92dc 100644 --- a/poezio/connection.py +++ b/poezio/connection.py @@ -161,6 +161,7 @@ class Connection(slixmpp.ClientXMPP): self.register_plugin('xep_0319') self.register_plugin('xep_0334') self.register_plugin('xep_0352') + self.register_plugin('xep_0380') self.init_plugins() def set_keepalive_values(self, option=None, value=None): diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index e79e4232..a0d40dd4 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -259,7 +259,10 @@ class HandlerCore: tmp_dir=tmp_dir, extract_images=extract_images) if not body: - return + if not self.core.xmpp.plugin['xep_0380'].has_eme(message): + return + self.core.xmpp.plugin['xep_0380'].replace_body_with_eme(message) + body = msg['body'] remote_nick = '' # normal message, we are the recipient |