aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-10 00:24:17 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-10 00:24:17 +0500
commit87615e95fc4f18cefa4e9f31255db3140340ec77 (patch)
tree791654481b75ba747ce13a7848ab6f113fdce9e6 /plugins/muc
parentf585f295c76b28787e66af111f755424ce4d5650 (diff)
downloadprosody-87615e95fc4f18cefa4e9f31255db3140340ec77.tar.gz
prosody-87615e95fc4f18cefa4e9f31255db3140340ec77.zip
MUC: Handle missing <value/> for <field type='boolean'/> in config form submissions.
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/muc.lib.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 89bd1304..4075be95 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -601,8 +601,12 @@ function room_mt:process_form(origin, stanza)
if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end
local fields = {};
for _, field in pairs(form.tags) do
- if field.name == "field" and field.attr.var and field.tags[1].name == "value" and #field.tags[1].tags == 0 then
- fields[field.attr.var] = field.tags[1][1] or "";
+ if field.name == "field" and field.attr.var then
+ if field.tags[1] and field.tags[1].name == "value" and #field.tags[1].tags == 0 then
+ fields[field.attr.var] = field.tags[1][1] or "";
+ elseif field.attr.type == "boolean" then
+ fields[field.attr.var] = "false";
+ end
end
end
if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end