From 351a197fbdd99b11505c283ae8c3f414bee38885 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 18 Sep 2020 12:18:51 +0200 Subject: util.dataforms: Define a integer + "max" datatype --- util/dataforms.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'util') diff --git a/util/dataforms.lua b/util/dataforms.lua index efb13ac9..25e198df 100644 --- a/util/dataforms.lua +++ b/util/dataforms.lua @@ -312,6 +312,15 @@ data_validators["xs:integer"] = 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 -- cgit v1.2.3