Yann Leboulanger pushed to branch master at gajim / gajim

Commits:
3e1ea4a3 by Yann Leboulanger at 2017-09-21T17:19:25+02:00
implement XEP-0380. Fixes #8734

- - - - -
0c167b65 by Yann Leboulanger at 2017-09-21T17:28:32+02:00
Merge branch 'master' into 'master'

implement XEP-0380. Fixes #8734

Closes #8734

See merge request !133
- - - - -


1 changed file:

- gajim/common/connection_handlers.py


Changes:

=====================================
gajim/common/connection_handlers.py
=====================================
--- a/gajim/common/connection_handlers.py
+++ b/gajim/common/connection_handlers.py
@@ -1080,6 +1080,27 @@ class ConnectionHandlersBase:
         app.plugin_manager.extension_point(
             'decrypt', self, obj, self._on_message_received)
         if not obj.encrypted:
+            # XEP-0380
+            enc_tag = obj.stanza.getTag('encryption', namespace=nbxmpp.NS_EME)
+            if enc_tag:
+                ns = enc_tag.getAttr('namespace')
+                if ns:
+                    if ns == 'urn:xmpp:otr:0':
+                        obj.msgtxt = _('This message was encrypted with OTR '
+                        'and could not be decrypted.')
+                    elif ns == 'jabber:x:encrypted':
+                        obj.msgtxt = _('This message was encrypted with Legacy 
'
+                        'OpenPGP and could not be decrypted. You can install '
+                        'the PGP plugin to handle those messages.')
+                    elif ns == 'urn:xmpp:openpgp:0':
+                        obj.msgtxt = _('This message was encrypted with '
+                        'OpenPGP for XMPP and could not be decrypted.')
+                    else:
+                        enc_name = enc_tag.getAttr('name')
+                        if not enc_name:
+                            enc_name = ns
+                        obj.msgtxt = _('This message was encrypted with %s '
+                        'and could not be decrypted.') % enc_name
             self._on_message_received(obj)
 
     def _on_message_received(self, obj):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/f50f22c4bd1441e9e2776471bf1037a29dda0a7b...0c167b6561dbb013ceb511bf412a74ac9a74f0bf

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/f50f22c4bd1441e9e2776471bf1037a29dda0a7b...0c167b6561dbb013ceb511bf412a74ac9a74f0bf
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to