From e30506979899bcb338010a4f59e0c2133fa778f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 19 Nov 2018 19:33:28 +0100 Subject: [PATCH] Fix receipts for MUC-PMs --- gajim/common/modules/receipts.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gajim/common/modules/receipts.py b/gajim/common/modules/receipts.py index f7a896417..fdc46ae71 100644 --- a/gajim/common/modules/receipts.py +++ b/gajim/common/modules/receipts.py @@ -72,15 +72,15 @@ class Receipts: self._con.connection.send(receipt) def _get_contact(self, event): - if event.mtype == 'chat': - contact = app.contacts.get_contact(self._account, event.jid) - if contact and contact.sub not in ('to', 'none'): - return contact - else: + if event.muc_pm: return app.contacts.get_gc_contact(self._account, event.jid, event.resource) + contact = app.contacts.get_contact(self._account, event.jid) + if contact is None and contact.sub not in ('to', 'none'): + return contact + @staticmethod def _build_answer_receipt(to, receipt_id): receipt = nbxmpp.Message(to=to, typ='chat') @@ -95,11 +95,16 @@ class Receipts: log.warning('Receipt without ID: %s', event.stanza) return log.info('Received %s', receipt_id) + + jid = event.jid + if event.muc_pm: + jid = event.fjid + app.nec.push_incoming_event( NetworkIncomingEvent('receipt-received', conn=self._con, receipt_id=receipt_id, - jid=event.jid)) + jid=jid)) def get_instance(*args, **kwargs):