projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
45540db
)
MUC: Fire per-field events for the config form, including those with value == nil...
author
Matthew Wild
<mwild1@gmail.com>
Fri, 11 Dec 2015 15:27:01 +0000
(15:27 +0000)
committer
Matthew Wild
<mwild1@gmail.com>
Fri, 11 Dec 2015 15:27:01 +0000
(15:27 +0000)
plugins/muc/muc.lib.lua
patch
|
blob
|
history
diff --git
a/plugins/muc/muc.lib.lua
b/plugins/muc/muc.lib.lua
index b2f89972ddf387983ab03e8de9af212c4788958e..8fec0ffca557ba63a0ede668a67a9db4640ab1c4 100644
(file)
--- 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
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
if form.tags[1] == nil then -- Instant room
- fields
=
{};
+ fields
, present = {},
{};
else
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;
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);
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));
if self.save then self:save(true); end
origin.send(st.reply(stanza));