aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-18 12:18:51 +0200
committerKim Alvefur <zash@zash.se>2020-09-18 12:18:51 +0200
commit351a197fbdd99b11505c283ae8c3f414bee38885 (patch)
treebfdd867bd3d1915b9e55f78da8031bf73ee23cc4
parent4c922a6d16a705a940302ab66d51d4ce04861bee (diff)
downloadprosody-351a197fbdd99b11505c283ae8c3f414bee38885.tar.gz
prosody-351a197fbdd99b11505c283ae8c3f414bee38885.zip
util.dataforms: Define a integer + "max" datatype
-rw-r--r--util/dataforms.lua9
1 files changed, 9 insertions, 0 deletions
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