Changeset

11630:855b065d5fd6

util.dataforms: Define a integer + "max" datatype
author Kim Alvefur <zash@zash.se>
date Fri, 18 Sep 2020 12:18:51 +0200
parents 11629:e6e56e2dd996
children 11631:6641ca266d94
files util/dataforms.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/dataforms.lua	Fri Jun 25 15:17:37 2021 +0200
+++ b/util/dataforms.lua	Fri Sep 18 12:18:51 2020 +0200
@@ -312,6 +312,15 @@
 		return true, n;
 	end
 
+data_validators["pubsub:integer-or-max"] =
+	function (data, field)
+		if data == "max" then
+			return true, data;
+		else
+			return data_validators["xs:integer"](data, field);
+		end
+	end
+
 
 local function get_form_type(form)
 	if not st.is_stanza(form) then