aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-12-11 15:27:01 +0000
committerMatthew Wild <mwild1@gmail.com>2015-12-11 15:27:01 +0000
commit422cae2d80d201bba8b182d1c215e0e647628bb1 (patch)
tree887087a706f461c5cc5c3ceff785da717b3e964b
parent14f1b1916dd8f0e13456b82c9e4feb8dad822593 (diff)
downloadprosody-422cae2d80d201bba8b182d1c215e0e647628bb1.tar.gz
prosody-422cae2d80d201bba8b182d1c215e0e647628bb1.zip
MUC: Fire per-field events for the config form, including those with value == nil (no <value/> element in form)
-rw-r--r--plugins/muc/muc.lib.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index b2f89972..8fec0ffc 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -644,11 +644,11 @@ function room_mt:process_form(origin, stanza)
if form.attr.type == "cancel" then
origin.send(st.reply(stanza));
elseif form.attr.type == "submit" then
- local fields;
+ local fields, errors, present;
if form.tags[1] == nil then -- Instant room
- fields = {};
+ fields, present = {}, {};
else
- fields = self:get_form_layout(stanza.attr.from):data(form);
+ fields, errors, present = self:get_form_layout(stanza.attr.from):data(form);
if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then
origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration"));
return true;
@@ -666,6 +666,11 @@ function room_mt:process_form(origin, stanza)
return true;
end
module:fire_event("muc-config-submitted", event);
+ for submitted_field in pairs(present) do
+ event.field, event.value = submitted_field, fields[submitted_field];
+ module:fire_event("muc-config-submitted/"..submitted_field, event);
+ end
+ event.field, event.value = nil, nil;
if self.save then self:save(true); end
origin.send(st.reply(stanza));