aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-03 02:05:49 +0100
committerKim Alvefur <zash@zash.se>2016-02-03 02:05:49 +0100
commit6a276c275d705bb72bcdc74f8450f188b3056d27 (patch)
tree14b9403c24dc354ae486a161404c596048a9018d /plugins/muc
parent11dcbc505b599add9294e27addaa697aa97e1e0c (diff)
downloadprosody-6a276c275d705bb72bcdc74f8450f188b3056d27.tar.gz
prosody-6a276c275d705bb72bcdc74f8450f188b3056d27.zip
MUC: Separate form data from form in disco#info event
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/description.lib.lua2
-rw-r--r--plugins/muc/muc.lib.lua9
-rw-r--r--plugins/muc/name.lib.lua2
3 files changed, 7 insertions, 6 deletions
diff --git a/plugins/muc/description.lib.lua b/plugins/muc/description.lib.lua
index c4b1bd09..d94bc3f1 100644
--- a/plugins/muc/description.lib.lua
+++ b/plugins/muc/description.lib.lua
@@ -24,8 +24,8 @@ local function add_form_option(event)
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 --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)
diff --git a/plugins/muc/name.lib.lua b/plugins/muc/name.lib.lua
index d9bfc4cf..18400e92 100644
--- a/plugins/muc/name.lib.lua
+++ b/plugins/muc/name.lib.lua
@@ -30,8 +30,8 @@ module:hook("muc-config-form", function(event)
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)