aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-03 21:06:59 +0200
committerKim Alvefur <zash@zash.se>2018-08-03 21:06:59 +0200
commit03cb4290344d3732c5b15d793ac13748a552990a (patch)
tree9cdc1a249dc7914e9ec2150d384cd6da2e5125b4
parent90a519fc704e5edc8f1753993d4acd675630f72e (diff)
downloadprosody-03cb4290344d3732c5b15d793ac13748a552990a.tar.gz
prosody-03cb4290344d3732c5b15d793ac13748a552990a.zip
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.
-rw-r--r--util/dataforms.lua3
1 files changed, 3 insertions, 0 deletions
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