Software /
code /
verse
Changeset
442:b2ae91f4fec9
util.dataforms: Support XEP-0122 validation
On par with what can be generated, for symetry.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Nov 2020 23:49:42 +0100 |
parents | 441:e4c0b1d7fd6b |
children | 443:89526c890363 |
files | util/dataforms.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/dataforms.lua Mon Nov 23 23:43:58 2020 +0100 +++ b/util/dataforms.lua Mon Nov 23 23:49:42 2020 +0100 @@ -62,6 +62,16 @@ end end end + local datatype_tag = tag:get_child("validate", xmlns_validate); + if datatype_tag then + field.datatype = datatype.attr.datatype; + local range_tag = datatype_tag:get_child("range"); + if range_tag then + field.range_min = tonumber(range_tag.attr.min); + field.range_max = tonumber(range_tag.attr.max); + end + end + end return new(layout); end