comparison libervia/backend/plugins/plugin_xep_0313.py @ 4222:1c30d574df2b

plugin XEP-0313: fix value used in `msg_from` when `from` is not explicitely specified.
author Goffi <goffi@goffi.org>
date Tue, 05 Mar 2024 17:31:56 +0100
parents 85f5e6225aa1
children 0d7bb4df2343
comparison
equal deleted inserted replaced
4221:2b000790b197 4222:1c30d574df2b
266 if mess_elt.name != "message": 266 if mess_elt.name != "message":
267 log.warning("unexpected stanza in archive: {xml}".format( 267 log.warning("unexpected stanza in archive: {xml}".format(
268 xml=mess_elt.toXml())) 268 xml=mess_elt.toXml()))
269 raise exceptions.DataError("Invalid element") 269 raise exceptions.DataError("Invalid element")
270 service_jid = client.jid.userhostJID() if service is None else service 270 service_jid = client.jid.userhostJID() if service is None else service
271 mess_from = mess_elt.getAttribute("from") or client.jid.userhostJID() 271 mess_from = mess_elt.getAttribute("from") or client.jid.userhost()
272 # we check that the message has been sent by the right service 272 # we check that the message has been sent by the right service
273 # if service is None (i.e. message expected from our own server) 273 # if service is None (i.e. message expected from our own server)
274 # from can be server jid or user's bare jid 274 # from can be server jid or user's bare jid
275 if (mess_from != service_jid.full() 275 if (mess_from != service_jid.full()
276 and not (service is None and mess_from == client.jid.host)): 276 and not (service is None and mess_from == client.jid.host)):