Philipp Hörist pushed to branch master at gajim / gajim


Commits:
7fd1c5d8 by Philipp Hörist at 2024-05-01T21:37:37+02:00
refactor: Message: Use origin-id for duplicate check

- - - - -


1 changed file:

- gajim/common/modules/message.py


Changes:

=====================================
gajim/common/modules/message.py
=====================================
@@ -139,24 +139,26 @@ def _message_received(self,
             self._log.debug('Generating id for message')
 
         stanza_id = self._get_stanza_id(properties)
+        origin_id = properties.origin_id
 
-        if (m_type != MessageType.GROUPCHAT and
-                direction == ChatDirection.OUTGOING):
+        if (m_type == MessageType.CHAT and
+                direction == ChatDirection.OUTGOING and
+                origin_id is not None):
             if app.storage.archive.check_if_message_id_exists(
-                    self._account, remote_jid, message_id):
-                self._log.info('Duplicated message received: %s', message_id)
+                    self._account, remote_jid, origin_id):
+                self._log.info('Duplicated message received: %s', origin_id)
                 return
 
         occupant = None
         if (m_type == MessageType.GROUPCHAT and
                 direction == ChatDirection.OUTGOING and
-                properties.origin_id is not None):
+                origin_id is not None):
 
             # Use origin-id because some group chats change the message id
             # on the reflection.
 
             pk = app.storage.archive.update_pending_message(
-                self._account, remote_jid, properties.origin_id, stanza_id)
+                self._account, remote_jid, origin_id, stanza_id)
 
             if pk is not None:
                 app.ged.raise_event(



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/7fd1c5d8c6f529d24e9c05d7192c8fbda68744ef

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/7fd1c5d8c6f529d24e9c05d7192c8fbda68744ef
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to