Dont use message receipts in message to ourself

This commit is contained in:
Philipp Hörist 2017-03-20 21:09:13 +01:00
parent c49d13bcae
commit 33a584b8b0
4 changed files with 24 additions and 20 deletions

View File

@ -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:

View File

@ -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',

View File

@ -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',

View File

@ -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,