# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1533323219 -7200
# Node ID 3a7a0b9f42f3fc9a1e5c3fe8b07616538f2b2ffb
# Parent  aa1b02411846f963b7ce8230857938d863ea63f8
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.

diff -r aa1b02411846 -r 3a7a0b9f42f3 util/dataforms.lua
--- a/util/dataforms.lua	Fri Aug 03 21:05:48 2018 +0200
+++ b/util/dataforms.lua	Fri Aug 03 21:06:59 2018 +0200
@@ -28,6 +28,9 @@
 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