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


Commits:
8ba0c95f by Philipp Hörist at 2024-05-20T14:52:44+02:00
cfix: Deduplicate PMs correctly

- - - - -


1 changed file:

- gajim/common/modules/message.py


Changes:

=====================================
gajim/common/modules/message.py
=====================================
@@ -141,7 +141,7 @@ def _message_received(self,
         stanza_id = self._get_stanza_id(properties)
         origin_id = properties.origin_id
 
-        if (m_type == MessageType.CHAT and
+        if (m_type in (MessageType.CHAT, MessageType.PM) and
                 direction == ChatDirection.OUTGOING and
                 origin_id is not None):
             if app.storage.archive.check_if_message_id_exists(
@@ -168,7 +168,7 @@ def _message_received(self,
                 return
 
         occupant = self._get_occupant_info(
-            remote_jid, direction, timestamp, properties)
+            remote_jid, m_type, direction, timestamp, properties)
 
         assert properties.bodies is not None
         message_text = properties.bodies.get(None)
@@ -282,12 +282,13 @@ def _get_real_jid(
     def _get_occupant_info(
         self,
         remote_jid: JID,
+        message_type: MessageType,
         direction: ChatDirection,
         timestamp: dt.datetime,
         properties: MessageProperties
     ) -> mod.Occupant | None:
 
-        if not properties.type.is_groupchat:
+        if message_type not in (MessageType.GROUPCHAT, MessageType.PM):
             return None
 
         if properties.jid.is_bare:
@@ -324,7 +325,7 @@ def _get_occupant_id(self, properties: MessageProperties) 
-> str | None:
 
         contact = self._client.get_module('Contacts').get_contact(
             properties.remote_jid, groupchat=True)
-        if contact.supports(Namespace.OCCUPANT_ID):
+        if contact.room.supports(Namespace.OCCUPANT_ID):
             return properties.occupant_id
         return None
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8ba0c95fdf2e545c94d0bd134f921eec81ff7f23

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8ba0c95fdf2e545c94d0bd134f921eec81ff7f23
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