Software /
code /
prosody
Diff
plugins/muc/muc.lib.lua @ 7119:50b9a7e86de9
MUC: Separate form data from form in disco#info event
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 03 Feb 2016 02:05:49 +0100 |
parent | 7089:890f4b2cc444 |
child | 7120:a6afe52159f1 |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Mon Feb 01 21:28:07 2016 +0000 +++ b/plugins/muc/muc.lib.lua Wed Feb 03 02:05:49 2016 +0100 @@ -310,16 +310,17 @@ 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)