From 33a584b8b0eb5180df8125845246cc69a865d9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 20 Mar 2017 21:09:13 +0100 Subject: [PATCH] Dont use message receipts in message to ourself --- src/chat_control.py | 10 +++++----- src/common/connection.py | 9 +++++---- src/common/connection_handlers.py | 22 ++++++++++++---------- src/roster_window.py | 3 ++- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index acab47a51..5e0870eb0 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -978,11 +978,11 @@ class ChatControl(ChatControlBase): def _on_sent(obj, msg_stanza, message, encrypted, xhtml, label): id_ = msg_stanza.getID() - if self.contact.supports(NS_RECEIPTS) and gajim.config.get_per( - 'accounts', self.account, 'request_receipt'): - xep0184_id = id_ - else: - xep0184_id = None + xep0184_id = None + if self.contact.jid != gajim.get_jid_from_account(self.account): + if self.contact.supports(NS_RECEIPTS) and gajim.config.get_per( + 'accounts', self.account, 'request_receipt'): + xep0184_id = id_ if label: displaymarking = label.getTag('displaymarking') else: diff --git a/src/common/connection.py b/src/common/connection.py index e0a257f33..ab669f93e 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -467,10 +467,11 @@ class CommonConnection: namespace=nbxmpp.NS_MSG_HINTS) # XEP-0184 - if msgtxt and gajim.config.get_per('accounts', self.name, - 'request_receipt') and contact and contact.supports( - nbxmpp.NS_RECEIPTS): - msg_iq.setTag('request', namespace=nbxmpp.NS_RECEIPTS) + if obj.jid != gajim.get_jid_from_account(self.name): + if msgtxt and gajim.config.get_per('accounts', self.name, + 'request_receipt') and contact and contact.supports( + nbxmpp.NS_RECEIPTS): + msg_iq.setTag('request', namespace=nbxmpp.NS_RECEIPTS) if obj.forward_from: addresses = msg_iq.addChild('addresses', diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 514ebd046..29598307e 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1174,17 +1174,19 @@ class ConnectionHandlersBase: jid_to = gajim.get_jid_without_resource(fjid_to) if jid_to == gajim.get_jid_from_account(self.name): reply = True - if obj.receipt_request_tag and gajim.config.get_per('accounts', - self.name, 'answer_receipts') and ((contact and contact.sub \ - not in ('to', 'none')) or gc_contact) and obj.mtype != 'error' and \ - reply: - receipt = nbxmpp.Message(to=obj.fjid, typ='chat') - receipt.setTag('received', namespace='urn:xmpp:receipts', - attrs={'id': obj.id_}) - if obj.thread_id: - receipt.setThread(obj.thread_id) - self.connection.send(receipt) + if obj.jid != gajim.get_jid_from_account(self.name): + if obj.receipt_request_tag and gajim.config.get_per('accounts', + self.name, 'answer_receipts') and ((contact and contact.sub \ + not in ('to', 'none')) or gc_contact) and obj.mtype != 'error' and \ + reply: + receipt = nbxmpp.Message(to=obj.fjid, typ='chat') + receipt.setTag('received', namespace='urn:xmpp:receipts', + attrs={'id': obj.id_}) + + if obj.thread_id: + receipt.setThread(obj.thread_id) + self.connection.send(receipt) # We got our message's receipt if obj.receipt_received_tag and gajim.config.get_per('accounts', diff --git a/src/roster_window.py b/src/roster_window.py index 132bd7f3a..81766ef94 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2734,7 +2734,8 @@ class RosterWindow: typ = 'error' if obj.forwarded and obj.sent: typ = 'out' - xep0184_id = obj.id_ + if obj.jid != gajim.get_jid_from_account(obj.conn.name): + xep0184_id = obj.id_ obj.session.control.print_conversation(obj.msgtxt, typ, tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject,