Philipp Hörist pushed to branch storage at gajim / gajim
Commits:
4f36e433 by Philipp Hörist at 2024-03-20T22:37:39+01:00
fix: Set occupant id correctly on outgoing messages
- - - - -
1 changed file:
- gajim/common/modules/message.py
Changes:
=====================================
gajim/common/modules/message.py
=====================================
@@ -34,6 +34,7 @@
from gajim.common.storage.archive.const import MessageType
from gajim.common.storage.base import is_unique_constraint_error
from gajim.common.storage.base import VALUE_MISSING
+from gajim.common.structs import MUCData
from gajim.common.structs import OutgoingMessage
@@ -148,7 +149,8 @@ def _message_received(self,
pk=pk))
return
- occupant = self._get_occupant_info(remote_jid, timestamp, properties)
+ occupant = self._get_occupant_info(
+ remote_jid, direction, timestamp, properties)
message_text = properties.body
oob_data = parse_oob(properties)
@@ -262,6 +264,7 @@ def _get_real_jid(self, properties: MessageProperties) ->
JID | None:
def _get_occupant_info(
self,
remote_jid: JID,
+ direction: ChatDirection,
timestamp: dt.datetime,
properties: MessageProperties
) -> mod.Occupant | None:
@@ -269,7 +272,11 @@ def _get_occupant_info(
if not properties.type.is_groupchat:
return None
- real_jid = self._get_real_jid(properties)
+ if direction == ChatDirection.OUTGOING:
+ real_jid = self._client.get_own_jid().new_as_bare()
+ else:
+ real_jid = self._get_real_jid(properties)
+
occupant_id = self._get_occupant_id(properties) or real_jid
if occupant_id is None:
return None
@@ -460,14 +467,16 @@ def send_message(self, message: OutgoingMessage) -> None:
return
resource = muc_data.nick
- occupant_id = muc_data.occupant_id
- if occupant_id is not None:
- occupant = mod.Occupant(
- account_=self._account,
- remote_jid_=remote_jid,
- id=str(occupant_id),
- updated_at=timestamp,
- )
+ real_jid = self._client.get_own_jid().new_as_bare()
+ occupant_id = muc_data.occupant_id or real_jid
+
+ occupant = mod.Occupant(
+ account_=self._account,
+ remote_jid_=remote_jid,
+ id=str(occupant_id),
+ real_remote_jid_=real_jid,
+ updated_at=timestamp,
+ )
state = MessageState.PENDING
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4f36e433124b0bb0d94d005bc4b24de2dba883db
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4f36e433124b0bb0d94d005bc4b24de2dba883db
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]