Comparison

plugins/muc/muc.lib.lua @ 10553:4d8119ffd433

MUC: Make note to handle configuration form errors [luacheck]
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 22:28:04 +0100
parent 10550:0566b45da987
child 10662:46373b97e648
comparison
equal deleted inserted replaced
10552:f1cf8c08a09d 10553:4d8119ffd433
842 function room_mt:process_form(origin, stanza) 842 function room_mt:process_form(origin, stanza)
843 local form = stanza.tags[1]:get_child("x", "jabber:x:data"); 843 local form = stanza.tags[1]:get_child("x", "jabber:x:data");
844 if form.attr.type == "cancel" then 844 if form.attr.type == "cancel" then
845 origin.send(st.reply(stanza)); 845 origin.send(st.reply(stanza));
846 elseif form.attr.type == "submit" then 846 elseif form.attr.type == "submit" then
847 -- luacheck: ignore 231/errors
847 local fields, errors, present; 848 local fields, errors, present;
848 if form.tags[1] == nil then -- Instant room 849 if form.tags[1] == nil then -- Instant room
849 fields, present = {}, {}; 850 fields, present = {}, {};
850 else 851 else
852 -- FIXME handle form errors
851 fields, errors, present = self:get_form_layout(stanza.attr.from):data(form); 853 fields, errors, present = self:get_form_layout(stanza.attr.from):data(form);
852 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then 854 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then
853 origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); 855 origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration"));
854 return true; 856 return true;
855 end 857 end