Software /
code /
prosody
Changeset
9238:0c1a1172d942
MUC: Add support for separate events for disco#info queries with a 'node'
Reserved nickname discovery uses this
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 03 Sep 2018 12:19:20 +0100 |
parents | 9237:b86c2e135797 |
children | 9239:03e37f7d6c97 |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Mon Sep 03 12:18:13 2018 +0100 +++ b/plugins/muc/muc.lib.lua Mon Sep 03 12:19:20 2018 +0100 @@ -334,13 +334,23 @@ 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)