add a <private> element to message stanza when message carbons is enabled and message is encrypted. Fixes #7616
This commit is contained in:
parent
309e7caf8a
commit
75a5c69871
1 changed files with 8 additions and 1 deletions
|
@ -164,6 +164,7 @@ class CommonConnection:
|
||||||
self.roster_supported = True
|
self.roster_supported = True
|
||||||
self.blocking_supported = False
|
self.blocking_supported = False
|
||||||
self.addressing_supported = False
|
self.addressing_supported = False
|
||||||
|
self.carbons_enabled = False
|
||||||
|
|
||||||
self.muc_jid = {} # jid of muc server for each transport type
|
self.muc_jid = {} # jid of muc server for each transport type
|
||||||
self._stun_servers = [] # STUN servers of our jabber server
|
self._stun_servers = [] # STUN servers of our jabber server
|
||||||
|
@ -420,6 +421,8 @@ class CommonConnection:
|
||||||
|
|
||||||
if msgenc:
|
if msgenc:
|
||||||
msg_iq.setTag(nbxmpp.NS_ENCRYPTED + ' x').setData(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:
|
if form_node:
|
||||||
msg_iq.addChild(node=form_node)
|
msg_iq.addChild(node=form_node)
|
||||||
|
@ -492,6 +495,9 @@ class CommonConnection:
|
||||||
# XEP-0200
|
# XEP-0200
|
||||||
if session.enable_encryption:
|
if session.enable_encryption:
|
||||||
msg_iq = session.encrypt_stanza(msg_iq)
|
msg_iq = session.encrypt_stanza(msg_iq)
|
||||||
|
if self.carbons_enabled:
|
||||||
|
msg_iq.addChild(name='private',
|
||||||
|
namespace=nbxmpp.NS_CARBONS)
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(jid, msg, keyID, forward_from, session, original_message,
|
callback(jid, msg, keyID, forward_from, session, original_message,
|
||||||
|
@ -1938,6 +1944,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.addressing_supported = True
|
self.addressing_supported = True
|
||||||
if nbxmpp.NS_CARBONS in obj.features and gajim.config.get_per(
|
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
|
# Server supports carbons, activate it
|
||||||
iq = nbxmpp.Iq('set')
|
iq = nbxmpp.Iq('set')
|
||||||
iq.setTag('enable', namespace=nbxmpp.NS_CARBONS)
|
iq.setTag('enable', namespace=nbxmpp.NS_CARBONS)
|
||||||
|
|
Loading…
Add table
Reference in a new issue