# HG changeset patch # User Kim Alvefur # Date 1582675175 -3600 # Node ID 49312378ba1d6e71f6cf8b00863d10557a3d587f # Parent dfc8257d8445c6f45a67b3cf3b179915460785c1 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. diff -r dfc8257d8445 -r 49312378ba1d util/adhoc.lua --- 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