diff options
author | Kim Alvefur <zash@zash.se> | 2015-12-08 20:19:30 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-12-08 20:19:30 +0100 |
commit | 64c33caee65e8e585c89a836247ba55b2a63245c (patch) | |
tree | a007e360cc644c038e60aa6f30f9f9dd62378732 /plugins | |
parent | db9b82199fdc9ea3fee6c032c03bebcdd669f4a0 (diff) | |
download | prosody-64c33caee65e8e585c89a836247ba55b2a63245c.tar.gz prosody-64c33caee65e8e585c89a836247ba55b2a63245c.zip |
MUC: Process only options that are included in a form (Fixes #521)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/muc.lib.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 48231c37..20e91192 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -674,7 +674,7 @@ function room_mt:process_form(origin, stanza) if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end - local fields = self:get_form_layout(stanza.attr.from):data(form); + local 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; @@ -683,8 +683,8 @@ function room_mt:process_form(origin, stanza) local changed = {}; local function handle_option(name, field, allowed) - local new = fields[field]; - if new == nil then return; end + local new, err, included = fields[field], errors[field], present[field]; + if not included then return; end if allowed and not allowed[new] then return; end if new == self["get_"..name](self) then return; end changed[name] = true; |