Software /
code /
prosody-modules
Changeset
4188:4611999fd8d3
mod_muc_batched_probe: don't rely on mt_room:respond_to_probe method
That method assumes it's responding to a `<presence>` stanza, which breaks for
the bached probe use-case.
author | JC Brand <jc@opkode.com> |
---|---|
date | Mon, 12 Oct 2020 13:21:16 +0200 |
parents | 4187:e2db07017332 |
children | 4189:22e7b3d6fcae 4190:e06258fc6cf1 |
files | mod_muc_batched_probe/mod_muc_batched_probe.lua |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_muc_batched_probe/mod_muc_batched_probe.lua Sat Oct 10 16:54:06 2020 +0200 +++ b/mod_muc_batched_probe/mod_muc_batched_probe.lua Mon Oct 12 13:21:16 2020 +0200 @@ -22,12 +22,29 @@ return; end; + local origin = event.origin; local room = get_room_from_jid(stanza.attr.to); + local probing_occupant = room:get_occupant_by_real_jid(stanza.attr.from); + if probing_occupant == nil then + origin.send(st.error_reply(stanza, "cancel", "not-acceptable", "You are not currently connected to this chat", room.jid)); + return true; + end + for item in query:children() do local probed_jid = item.attr.jid; - room:respond_to_probe(stanza.attr.from, probed_jid); + local probed_occupant = room:get_occupant_by_nick(probed_jid); + if probed_occupant == nil then + local pr = room:build_unavailable_presence(probed_jid, stanza.attr.from); + if pr then + room:route_stanza(pr); + end + return; + end + local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"}); + room:publicise_occupant_status(probed_occupant, x, nil, nil, nil, nil, false, probing_occupant); + end - event.origin.send(st.reply(stanza)); + origin.send(st.reply(stanza)); return true; end