From 98c57924d4dfc40dcd1c496476d33431fe84f1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 10 Apr 2022 17:12:13 +0200 Subject: [PATCH] Ensure we only ignore our own reflections in 1:1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/tabs/conversationtab.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index ab364649..f6b5708b 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -110,11 +110,20 @@ class ConversationTab(OneToOneTab): The message can come from us (carbon copy). """ + + # Prevent messages coming from our own devices (1:1) to be reflected + if message['to'].bare == self.core.xmpp.boundjid.bare and \ + message['from'].bare == self.core.xmpp.boundjid.bare: + _, index = self._text_buffer._find_message(message['id']) + if index != -1: + return + use_xhtml = config.get_by_tabname( 'enable_xhtml_im', message['from'].bare ) tmp_dir = get_image_cache() + # normal message, we are the recipient if message['to'].bare == self.core.xmpp.boundjid.bare: conv_jid = message['from'] @@ -123,13 +132,6 @@ class ConversationTab(OneToOneTab): self.last_remote_message = datetime.now() remote_nick = self.get_nick() # we wrote the message (happens with carbons) - elif message['from'].full == self.core.xmpp.boundjid.full: - # XXX: We shouldn't look through messages that have been displayed - # but through messages that have been logged. These don't include - # IDs though. - _, index = self._text_buffer._find_message(message['id']) - if index != -1: # The id has been found - return elif message['from'].bare == self.core.xmpp.boundjid.bare: conv_jid = message['to'] jid = self.core.xmpp.boundjid