Mercurial > prosody-hg
diff plugins/muc/mod_muc.lua @ 13877:4e109e917f89
Merge 13.0->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 19 May 2025 18:41:55 +0200 |
| parents | 3609d8fcad00 |
| children | c6010e1322aa |
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
