Add support for XEP-0380: Explicit Message Encryption
Both for displaying incoming messages, and sending OTR and legacy OpenPGP.
This commit is contained in:
parent
1f43535f45
commit
76445a6867
4 changed files with 7 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue