Changeset

6982:c515f9491ce6

MUC: Process only options that are included in a form (Fixes #521)
author Kim Alvefur <zash@zash.se>
date Tue, 08 Dec 2015 20:19:30 +0100
parents 6981:bcaa553de6e8
children 6983:05ef46379165
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Tue Dec 08 20:16:49 2015 +0100
+++ b/plugins/muc/muc.lib.lua	Tue Dec 08 20:19:30 2015 +0100
@@ -674,7 +674,7 @@
 	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 @@
 	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;