From 832484e723560cabab9a058ef2f8c1299ecdf4a3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 3 Aug 2018 21:06:59 +0200 Subject: util.dataforms: Skip all fields for the 'cancel' form type XEP-0004 says: > a data form of type "cancel" SHOULD NOT contain any 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. --- util/dataforms.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util') diff --git a/util/dataforms.lua b/util/dataforms.lua index 30a1dde7..5a856abe 100644 --- a/util/dataforms.lua +++ b/util/dataforms.lua @@ -28,6 +28,9 @@ end function form_t.form(layout, data, formtype) if not formtype then formtype = "form" end local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype }); + if formtype == "cancel" then + return form; + end if layout.title then form:tag("title"):text(layout.title):up(); end -- cgit v1.2.3