Commit 4fb9105a authored by Yann Leboulanger's avatar Yann Leboulanger

add a <private> element to message stanza when message carbons is enabled and...

add a <private> element to message stanza when message carbons is enabled and message is encrypted. Fixes #7616
parent 9b95af1f
......@@ -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
......@@ -421,6 +422,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)
......@@ -493,6 +496,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,
......@@ -1939,7 +1945,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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment