diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-09-03 12:19:20 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-09-03 12:19:20 +0100 |
commit | 0da19da4a6d7d003733cf133baacd010c699c891 (patch) | |
tree | ab95297058d0aaa192a4122d3c92774fc825576d /plugins/muc | |
parent | 293efa61df6d85670ea8eb62933d2416f2ee4f6b (diff) | |
download | prosody-0da19da4a6d7d003733cf133baacd010c699c891.tar.gz prosody-0da19da4a6d7d003733cf133baacd010c699c891.zip |
MUC: Add support for separate events for disco#info queries with a 'node'
Reserved nickname discovery uses this
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/muc.lib.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index f943ae7c..435ca805 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -334,13 +334,23 @@ function room_mt:send_occupant_list(to, filter) end function room_mt:get_disco_info(stanza) - local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#info"); - local form = dataform.new { - { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/muc#roominfo" }; - }; - local formdata = {}; - module:fire_event("muc-disco#info", {room = self; reply = reply; form = form, formdata = formdata ;}); - reply:add_child(form:form(formdata, "result")); + local node = stanza.tags[1].attr.node or ""; + local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#info", { node = node }); + local event_name = "muc-disco#info"; + local event_data = { room = self, reply = reply, stanza = stanza }; + + if node ~= "" then + event_name = event_name.."/"..node; + else + event_data.form = dataform.new { + { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/muc#roominfo" }; + }; + event_data.formdata = {}; + end + module:fire_event(event_name, event_data); + if event_data.form then + reply:add_child(event_data.form:form(event_data.formdata, "result")); + end return reply; end module:hook("muc-disco#info", function(event) |