Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
4368:2bdf0c16d852 | 4369:b74a76a8e168 |
---|---|
216 async def profile_connected(self, client): | 216 async def profile_connected(self, client): |
217 client.muc_service = await self.get_muc_service(client) | 217 client.muc_service = await self.get_muc_service(client) |
218 | 218 |
219 def _message_parse_trigger(self, client, message_elt, data): | 219 def _message_parse_trigger(self, client, message_elt, data): |
220 """Add stanza-id from the room if present""" | 220 """Add stanza-id from the room if present""" |
221 if message_elt.getAttribute("type") != C.MESS_TYPE_GROUPCHAT: | 221 if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: |
222 return True | 222 # stanza_id will not be filled by parse_message because the emitter |
223 | 223 # is the room and not our server, so we have to parse it here |
224 # stanza_id will not be filled by parse_message because the emitter | 224 room_jid = data["from"].userhostJID() |
225 # is the room and not our server, so we have to parse it here | 225 stanza_id = self._si.get_stanza_id(message_elt, room_jid) |
226 room_jid = data["from"].userhostJID() | 226 if stanza_id: |
227 stanza_id = self._si.get_stanza_id(message_elt, room_jid) | 227 data["extra"]["stanza_id"] = stanza_id |
228 if stanza_id: | 228 |
229 data["extra"]["stanza_id"] = stanza_id | 229 return True |
230 | 230 |
231 def message_received_trigger(self, client, message_elt, post_treat): | 231 def message_received_trigger(self, client, message_elt, post_treat): |
232 if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: | 232 if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: |
233 if message_elt.subject: | 233 if message_elt.subject: |
234 return False | 234 return False |