From 7cb31512c63a839905e9fc750d1c24a396001120 Mon Sep 17 00:00:00 2001 From: lovetox Date: Tue, 18 Oct 2016 16:26:03 +0200 Subject: [PATCH] Add no-store hint to ChatStates --- src/common/connection.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index f20cbfc2a..e1cea9b8c 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -481,6 +481,12 @@ class CommonConnection: # tag is the active event if chatstate and contact and contact.supports(nbxmpp.NS_CHATSTATES): msg_iq.setTag(chatstate, namespace=nbxmpp.NS_CHATSTATES) + only_chatste = False + if not msgtxt: + only_chatste = True + if only_chatste and not session.enable_encryption: + msg_iq.setTag('no-store', + namespace=nbxmpp.NS_MSG_HINTS) # XEP-0184 if msgtxt and gajim.config.get_per('accounts', self.name, @@ -504,15 +510,18 @@ class CommonConnection: msg_iq = session.encrypt_stanza(msg_iq) if self.carbons_enabled: msg_iq.addChild(name='private', - namespace=nbxmpp.NS_CARBONS) + namespace=nbxmpp.NS_CARBONS) msg_iq.addChild(name='no-permanent-store', - namespace=nbxmpp.NS_MSG_HINTS) + namespace=nbxmpp.NS_MSG_HINTS) msg_iq.addChild(name='no-copy', - namespace=nbxmpp.NS_MSG_HINTS) + namespace=nbxmpp.NS_MSG_HINTS) + if only_chatste: + msg_iq.addChild(name='no-store', + namespace=nbxmpp.NS_MSG_HINTS) if callback: callback(jid, msg, keyID, forward_from, session, original_message, - subject, type_, msg_iq, xhtml) + subject, type_, msg_iq, xhtml) def log_message(self, jid, msg, forward_from, session, original_message, subject, type_, xhtml=None, additional_data={}):