diff options
author | Kim Alvefur <zash@zash.se> | 2016-02-03 02:05:49 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-02-03 02:05:49 +0100 |
commit | c2eb4be9a14dec4b4c4fc086f1f6f2bd70991407 (patch) | |
tree | 14b9403c24dc354ae486a161404c596048a9018d /plugins/muc/muc.lib.lua | |
parent | 6cb4a340b97827f572c55b87b254352e20e38f4a (diff) | |
download | prosody-c2eb4be9a14dec4b4c4fc086f1f6f2bd70991407.tar.gz prosody-c2eb4be9a14dec4b4c4fc086f1f6f2bd70991407.zip |
MUC: Separate form data from form in disco#info event
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r-- | plugins/muc/muc.lib.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index b7976199..795f8ccb 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -310,16 +310,17 @@ function room_mt:get_disco_info(stanza) local form = dataform.new { { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/muc#roominfo" }; }; - module:fire_event("muc-disco#info", {room = self; reply = reply; form = form;}); - reply:add_child(form:form(nil, "result")); + local formdata = {}; + module:fire_event("muc-disco#info", {room = self; reply = reply; form = form, formdata = formdata ;}); + reply:add_child(form:form(formdata, "result")); return reply; end module:hook("muc-disco#info", function(event) event.reply:tag("feature", {var = "http://jabber.org/protocol/muc"}):up(); end); module:hook("muc-disco#info", function(event) - local count = iterators.count(event.room:each_occupant()); - table.insert(event.form, { name = "muc#roominfo_occupants", label = "Number of occupants", value = tostring(count) }); + table.insert(event.form, { name = "muc#roominfo_occupants", label = "Number of occupants" }); + event.formdata["muc#roominfo_occupants"] = tostring(iterators.count(event.room:each_occupant())); end); function room_mt:get_disco_items(stanza) |