Commit 33a584b8 authored by Philipp Hörist's avatar Philipp Hörist

Dont use message receipts in message to ourself

parent c49d13bc
......@@ -978,11 +978,11 @@ def send_message(self, message, keyID='', chatstate=None, xhtml=None,
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:
......
......@@ -467,10 +467,11 @@ def _build_message_stanza(self, obj, msgenc=None):
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',
......
......@@ -1174,17 +1174,19 @@ def _nec_decrypted_message_received(self, obj):
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',
......
......@@ -2734,7 +2734,8 @@ def _nec_decrypted_message_received(self, obj):
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,
......
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