From 75a5c698711f9a0c9505438ef8e950057959d4a7 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 1 Jan 2014 20:49:53 +0100 Subject: [PATCH] add a element to message stanza when message carbons is enabled and message is encrypted. Fixes #7616 --- src/common/connection.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/connection.py b/src/common/connection.py index 96e8ae085..44c318dd2 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -164,6 +164,7 @@ class CommonConnection: self.roster_supported = True self.blocking_supported = False self.addressing_supported = False + self.carbons_enabled = False self.muc_jid = {} # jid of muc server for each transport type self._stun_servers = [] # STUN servers of our jabber server @@ -420,6 +421,8 @@ class CommonConnection: if msgenc: msg_iq.setTag(nbxmpp.NS_ENCRYPTED + ' x').setData(msgenc) + if self.carbons_enabled: + msg_iq.addChild(name='private', namespace=nbxmpp.NS_CARBONS) if form_node: msg_iq.addChild(node=form_node) @@ -492,6 +495,9 @@ class CommonConnection: # XEP-0200 if session.enable_encryption: msg_iq = session.encrypt_stanza(msg_iq) + if self.carbons_enabled: + msg_iq.addChild(name='private', + namespace=nbxmpp.NS_CARBONS) if callback: callback(jid, msg, keyID, forward_from, session, original_message, @@ -1937,7 +1943,8 @@ class Connection(CommonConnection, ConnectionHandlers): if nbxmpp.NS_ADDRESS in obj.features: self.addressing_supported = True if nbxmpp.NS_CARBONS in obj.features and gajim.config.get_per( - 'accounts', self.name, 'enable_message_carbons'): + 'accounts', self.name, 'enable_message_carbons'): + self.carbons_enabled = True # Server supports carbons, activate it iq = nbxmpp.Iq('set') iq.setTag('enable', namespace=nbxmpp.NS_CARBONS)