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


Commits:
f4336f45 by Philipp Hörist at 2024-04-12T21:20:27+02:00
cfix: Message: Store resource for private messages

- - - - -


1 changed file:

- gajim/common/modules/message.py


Changes:

=====================================
gajim/common/modules/message.py
=====================================
@@ -469,11 +469,13 @@ def send_message(self, message: OutgoingMessage) -> None:
         resource = self._client.get_bound_jid().resource
         state = MessageState.ACKNOWLEDGED
 
-        if m_type == MessageType.GROUPCHAT:
-            muc_data = self._client.get_module('MUC').get_muc_data(remote_jid)
+        if m_type in (MessageType.GROUPCHAT, MessageType.PM):
+            # PM is a full jid, so convert to bare
+            muc_jid = remote_jid.new_as_bare()
+            muc_data = self._client.get_module('MUC').get_muc_data(muc_jid)
             if muc_data is None:
                 self._log.warning('Trying to send message to unknown MUC: %s',
-                                  remote_jid)
+                                  muc_jid)
                 return
 
             resource = muc_data.nick
@@ -485,10 +487,12 @@ def send_message(self, message: OutgoingMessage) -> None:
                 remote_jid_=remote_jid,
                 id=str(occupant_id),
                 real_remote_jid_=real_jid,
+                nickname=resource,
                 updated_at=timestamp,
             )
 
-            state = MessageState.PENDING
+            if m_type == MessageType.GROUPCHAT:
+                state = MessageState.PENDING
 
         encryption_data = None
         if message.is_encrypted:



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

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