# HG changeset patch # User Kim Alvefur # Date 1600424331 -7200 # Node ID 855b065d5fd64e3393869d2ab4222802944ffe7d # Parent e6e56e2dd996df1c8f4578787072fc89e29b9985 util.dataforms: Define a integer + "max" datatype diff -r e6e56e2dd996 -r 855b065d5fd6 util/dataforms.lua --- 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