Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0045.py @ 4369:b74a76a8e168
plugin XEP-0045: Fix `_message_parse_trigger` which was incorrectly breaking the trigger workflow:
`None` was returned in some case instead of `True`, breaking the trigger workflow.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 06 May 2025 00:34:01 +0200 |
parents | a987a8ce34b9 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0045.py Tue May 06 00:34:01 2025 +0200 +++ b/libervia/backend/plugins/plugin_xep_0045.py Tue May 06 00:34:01 2025 +0200 @@ -218,15 +218,15 @@ def _message_parse_trigger(self, client, message_elt, data): """Add stanza-id from the room if present""" - if message_elt.getAttribute("type") != C.MESS_TYPE_GROUPCHAT: - return True + if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: + # stanza_id will not be filled by parse_message because the emitter + # is the room and not our server, so we have to parse it here + room_jid = data["from"].userhostJID() + stanza_id = self._si.get_stanza_id(message_elt, room_jid) + if stanza_id: + data["extra"]["stanza_id"] = stanza_id - # stanza_id will not be filled by parse_message because the emitter - # is the room and not our server, so we have to parse it here - room_jid = data["from"].userhostJID() - stanza_id = self._si.get_stanza_id(message_elt, room_jid) - if stanza_id: - data["extra"]["stanza_id"] = stanza_id + return True def message_received_trigger(self, client, message_elt, post_treat): if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: