Mercurial > prosody-hg
changeset 13877:4e109e917f89
Merge 13.0->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 19 May 2025 18:41:55 +0200 |
| parents | bfa8ac5881a0 (current diff) 3609d8fcad00 (diff) |
| children | 9ec961173b1c |
| files | |
| diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Tue May 13 22:38:34 2025 +0200 +++ b/plugins/muc/mod_muc.lua Mon May 19 18:41:55 2025 +0200 @@ -104,6 +104,7 @@ local jid_split = require "prosody.util.jid".split; local jid_prep = require "prosody.util.jid".prep; local jid_bare = require "prosody.util.jid".bare; +local jid_resource = require "prosody.util.jid".resource; local st = require "prosody.util.stanza"; local cache = require "prosody.util.cache"; @@ -441,6 +442,13 @@ end end); +local function is_join_presence(stanza) + return stanza.name == "presence" + and stanza.attr.type == nil + and jid_resource(stanza.attr.to) ~= nil + and stanza:get_child("x", "http://jabber.org/protocol/muc"); +end + for event_name, method in pairs { -- Normal room interactions ["iq-get/bare/http://jabber.org/protocol/disco#info:query"] = "handle_disco_info_get_query" ; @@ -496,7 +504,7 @@ origin.send(st.error_reply(stanza, "modify", "jid-malformed", nil, module.host)); return true; end - if stanza.attr.type == nil and stanza.name == "presence" and stanza:get_child("x", "http://jabber.org/protocol/muc") then + if is_join_presence(stanza) then room = muclib.new_room(room_jid); return room:handle_first_presence(origin, stanza); elseif stanza.attr.type ~= "error" then
--- a/spec/scansion/muc_create_destroy.scs Tue May 13 22:38:34 2025 +0200 +++ b/spec/scansion/muc_create_destroy.scs Mon May 19 18:41:55 2025 +0200 @@ -17,6 +17,14 @@ Romeo connects Romeo sends: + <presence to="garden@conference.localhost"> + <x xmlns="http://jabber.org/protocol/muc"/> + </presence> + +Romeo receives: + <presence from="garden@conference.localhost" type="error"/> + +Romeo sends: <presence to="garden@conference.localhost/romeo"> <x xmlns="http://jabber.org/protocol/muc"/> </presence>
