changeset 8ae55b949235 in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=8ae55b949235 description: reply to message receipt only when we are the recipient of the message. see #7548. [tmolitor] display message receipt (xep 0184) for carbon copied messages. Fixes #8258
diffstat:
src/common/connection_handlers.py | 12 ++++++++++-- src/common/connection_handlers_events.py | 3 +++ src/roster_window.py | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-)
diffs (62 lines):
diff -r dc4cdb3dd133 -r 8ae55b949235 src/common/connection_handlers.py --- a/src/common/connection_handlers.py Sat Feb 20 15:59:01 2016 +0100 +++ b/src/common/connection_handlers.py Sat Feb 20 20:04:47 2016 +0100 @@ -1169,12 +1169,20 @@ contact = gajim.contacts.get_contact(self.name, obj.jid) nick = obj.resource gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick) + jid_to = obj.stanza.getTo() + reply = False + if not jid_to: + reply = True + else: + fjid_to = helpers.parse_jid(str(jid_to)) + 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 \ - not obj.forwarded: + reply: receipt = nbxmpp.Message(to=obj.fjid, typ='chat') - receipt.setID(obj.id_) receipt.setTag('received', namespace='urn:xmpp:receipts', attrs={'id': obj.id_})
diff -r dc4cdb3dd133 -r 8ae55b949235 src/common/connection_handlers_events.py --- a/src/common/connection_handlers_events.py Sat Feb 20 15:59:01 2016 +0100 +++ b/src/common/connection_handlers_events.py Sat Feb 20 20:04:47 2016 +0100 @@ -2349,6 +2349,9 @@ self.control_focused = True
def handle_incoming_msg_event(self, msg_obj): + # don't alert for carbon copied messages from ourselves + if msg_obj.sent: + return if not msg_obj.msgtxt: return self.jid = msg_obj.jid diff -r dc4cdb3dd133 -r 8ae55b949235 src/roster_window.py --- a/src/roster_window.py Sat Feb 20 15:59:01 2016 +0100 +++ b/src/roster_window.py Sat Feb 20 20:04:47 2016 +0100 @@ -2756,15 +2756,18 @@ return if obj.session.control and obj.mtype == 'chat': typ = '' + xep0184_id = None if obj.mtype == 'error': typ = 'error' if obj.forwarded and obj.sent: typ = 'out' + xep0184_id = obj.id_
obj.session.control.print_conversation(obj.msgtxt, typ, tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject, xhtml=obj.xhtml, displaymarking=obj.displaymarking, - msg_id=obj.msg_id, correct_id=(obj.id_, obj.correct_id)) + msg_id=obj.msg_id, correct_id=(obj.id_, obj.correct_id), + xep0184_id=xep0184_id) if obj.msg_id: pw = obj.session.control.parent_win end = obj.session.control.was_at_the_end