Comparison

util/dataforms.lua @ 9089:3a7a0b9f42f3

util.dataforms: Skip all fields for the 'cancel' form type XEP-0004 says: > a data form of type "cancel" SHOULD NOT contain any <field/> elements. The title and instructions don't seem to be of much value in this case either. I'm not aware of 'cancel' being used anywhere, so this should break nothing. Early return is always nice.
author Kim Alvefur <zash@zash.se>
date Fri, 03 Aug 2018 21:06:59 +0200
parent 9088:aa1b02411846
child 9090:56c52cb4d44e
comparison
equal deleted inserted replaced
9088:aa1b02411846 9089:3a7a0b9f42f3
26 end 26 end
27 27
28 function form_t.form(layout, data, formtype) 28 function form_t.form(layout, data, formtype)
29 if not formtype then formtype = "form" end 29 if not formtype then formtype = "form" end
30 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype }); 30 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype });
31 if formtype == "cancel" then
32 return form;
33 end
31 if layout.title then 34 if layout.title then
32 form:tag("title"):text(layout.title):up(); 35 form:tag("title"):text(layout.title):up();
33 end 36 end
34 if layout.instructions then 37 if layout.instructions then
35 form:tag("instructions"):text(layout.instructions):up(); 38 form:tag("instructions"):text(layout.instructions):up();