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
This commit is contained in:
		
							parent
							
								
									580cdb2723
								
							
						
					
					
						commit
						1316866265
					
				
					 3 changed files with 17 additions and 3 deletions
				
			
		| 
						 | 
					@ -1169,12 +1169,20 @@ class ConnectionHandlersBase:
 | 
				
			||||||
        contact = gajim.contacts.get_contact(self.name, obj.jid)
 | 
					        contact = gajim.contacts.get_contact(self.name, obj.jid)
 | 
				
			||||||
        nick = obj.resource
 | 
					        nick = obj.resource
 | 
				
			||||||
        gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick)
 | 
					        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',
 | 
					        if obj.receipt_request_tag and gajim.config.get_per('accounts',
 | 
				
			||||||
        self.name, 'answer_receipts') and ((contact and contact.sub \
 | 
					        self.name, 'answer_receipts') and ((contact and contact.sub \
 | 
				
			||||||
        not in ('to', 'none')) or gc_contact) and obj.mtype != 'error' and \
 | 
					        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 = nbxmpp.Message(to=obj.fjid, typ='chat')
 | 
				
			||||||
            receipt.setID(obj.id_)
 | 
					 | 
				
			||||||
            receipt.setTag('received', namespace='urn:xmpp:receipts',
 | 
					            receipt.setTag('received', namespace='urn:xmpp:receipts',
 | 
				
			||||||
                attrs={'id': obj.id_})
 | 
					                attrs={'id': obj.id_})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2349,6 +2349,9 @@ class NotificationEvent(nec.NetworkIncomingEvent):
 | 
				
			||||||
                self.control_focused = True
 | 
					                self.control_focused = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def handle_incoming_msg_event(self, msg_obj):
 | 
					    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:
 | 
					        if not msg_obj.msgtxt:
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        self.jid = msg_obj.jid
 | 
					        self.jid = msg_obj.jid
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2756,15 +2756,18 @@ class RosterWindow:
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        if obj.session.control and obj.mtype == 'chat':
 | 
					        if obj.session.control and obj.mtype == 'chat':
 | 
				
			||||||
            typ = ''
 | 
					            typ = ''
 | 
				
			||||||
 | 
					            xep0184_id = None
 | 
				
			||||||
            if obj.mtype == 'error':
 | 
					            if obj.mtype == 'error':
 | 
				
			||||||
                typ = 'error'
 | 
					                typ = 'error'
 | 
				
			||||||
            if obj.forwarded and obj.sent:
 | 
					            if obj.forwarded and obj.sent:
 | 
				
			||||||
                typ = 'out'
 | 
					                typ = 'out'
 | 
				
			||||||
 | 
					                xep0184_id = obj.id_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            obj.session.control.print_conversation(obj.msgtxt, typ,
 | 
					            obj.session.control.print_conversation(obj.msgtxt, typ,
 | 
				
			||||||
                tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject,
 | 
					                tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject,
 | 
				
			||||||
                xhtml=obj.xhtml, displaymarking=obj.displaymarking,
 | 
					                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:
 | 
					            if obj.msg_id:
 | 
				
			||||||
                pw = obj.session.control.parent_win
 | 
					                pw = obj.session.control.parent_win
 | 
				
			||||||
                end = obj.session.control.was_at_the_end
 | 
					                end = obj.session.control.was_at_the_end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue