Comparison

plugins/muc/muc.lib.lua @ 3580:39547152bb72

MUC: Handle missing <value/> for <field type='boolean'/> in config form submissions.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 10 Nov 2010 00:24:17 +0500
parent 3540:bc139431830b
child 3590:dcc5f3402f5b
comparison
equal deleted inserted replaced
3579:9720fa5e0991 3580:39547152bb72
599 if not form then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); return; end 599 if not form then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); return; end
600 if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end 600 if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end
601 if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end 601 if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end
602 local fields = {}; 602 local fields = {};
603 for _, field in pairs(form.tags) do 603 for _, field in pairs(form.tags) do
604 if field.name == "field" and field.attr.var and field.tags[1].name == "value" and #field.tags[1].tags == 0 then 604 if field.name == "field" and field.attr.var then
605 fields[field.attr.var] = field.tags[1][1] or ""; 605 if field.tags[1] and field.tags[1].name == "value" and #field.tags[1].tags == 0 then
606 fields[field.attr.var] = field.tags[1][1] or "";
607 elseif field.attr.type == "boolean" then
608 fields[field.attr.var] = "false";
609 end
606 end 610 end
607 end 611 end
608 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end 612 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end
609 613
610 local dirty = false 614 local dirty = false