changeset 4581:3e2e708fd18b

mod_adhoc_dataforms_demo: Add compat with 0.11 (vs trunk api change) The name of the "access for anyone" permission level changed from "user" in 0.11 to "any" in 0.12/trunk to make it clearer that it's basically unrestricted. This is unfortunately not backwards-compatible. Thanks to Sam for stumbling upon this during a demo.
author Kim Alvefur <zash@zash.se>
date Tue, 01 Jun 2021 19:23:32 +0200
parents 785389a2d2b3
children cc20493018f6
files mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua	Sat May 29 15:34:41 2021 +0200
+++ b/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua	Tue Jun 01 19:23:32 2021 +0200
@@ -180,9 +180,14 @@
 	return next_step, state;
 end
 
+local permission = "any";
+if not module.send_iq then -- hacky attempt at detecting 0.11 or earlier
+	permission = "user";
+end
+
 module:depends("adhoc");
 module:provides("adhoc",
 	adhoc_new("Multi-step command demo",
 		"xmpp:zash.se/mod_adhoc_dataforms_demo#multi",
-		multi_step_command, "any"));
+		multi_step_command, permission));