Changeset

10667:49312378ba1d

util.adhoc: Allow passing dataforms in initial command This might not be quite legal per XEP-0050, but makes it possible to call simpler commands without keeping state across another roundtrip.
author Kim Alvefur <zash@zash.se>
date Wed, 26 Feb 2020 00:59:35 +0100
parents 10666:dfc8257d8445
children 10668:25c84c0a66fd
files util/adhoc.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/adhoc.lua	Mon Feb 24 23:33:53 2020 +0100
+++ b/util/adhoc.lua	Wed Feb 26 00:59:35 2020 +0100
@@ -2,7 +2,7 @@
 
 local function new_simple_form(form, result_handler)
 	return function(self, data, state)
-		if state then
+		if state or data.form then
 			if data.action == "cancel" then
 				return { status = "canceled" };
 			end
@@ -16,7 +16,7 @@
 
 local function new_initial_data_form(form, initial_data, result_handler)
 	return function(self, data, state)
-		if state then
+		if state or data.form then
 			if data.action == "cancel" then
 				return { status = "canceled" };
 			end