# HG changeset patch # User Kim Alvefur # Date 1454461549 -3600 # Node ID 50b9a7e86de9c8f52aa9cdefd1ca18af4c4c16b4 # Parent ecba5fee4867e932d582ba29b1ddd014b195fe8a MUC: Separate form data from form in disco#info event diff -r ecba5fee4867 -r 50b9a7e86de9 plugins/muc/description.lib.lua --- a/plugins/muc/description.lib.lua Mon Feb 01 21:28:07 2016 +0000 +++ b/plugins/muc/description.lib.lua Wed Feb 03 02:05:49 2016 +0100 @@ -24,8 +24,8 @@ name = "muc#roomconfig_roomdesc"; type = "text-single"; label = "Description"; - value = get_description(event.room) or ""; }); + event.formdata["muc#roomconfig_roomdesc"] = get_description(event.room) or ""; end module:hook("muc-disco#info", add_form_option); module:hook("muc-config-form", add_form_option); diff -r ecba5fee4867 -r 50b9a7e86de9 plugins/muc/muc.lib.lua --- 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) diff -r ecba5fee4867 -r 50b9a7e86de9 plugins/muc/name.lib.lua --- a/plugins/muc/name.lib.lua Mon Feb 01 21:28:07 2016 +0000 +++ b/plugins/muc/name.lib.lua Wed Feb 03 02:05:49 2016 +0100 @@ -30,8 +30,8 @@ name = "muc#roomconfig_roomname"; type = "text-single"; label = "Name"; - value = get_name(event.room) or ""; }); + event.formdata["muc#roomconfig_roomname"] = get_description(event.room) or ""; end); module:hook("muc-config-submitted/muc#roomconfig_roomname", function(event)