aboutsummaryrefslogtreecommitdiffstats
path: root/util/dataforms.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-12-10 18:58:30 +0000
committerMatthew Wild <mwild1@gmail.com>2015-12-10 18:58:30 +0000
commita6215475087bab66b80db99e23a530f5652d69d4 (patch)
tree6abe7e628961f73a7f0a5b15d5715ded3345a77a /util/dataforms.lua
parentdd37beeff9f229dee36da04d625d5200b69f945c (diff)
parent7f8d1c0995b51435b4d6a4f5c7a5d5ed7ab5d8e2 (diff)
downloadprosody-a6215475087bab66b80db99e23a530f5652d69d4.tar.gz
prosody-a6215475087bab66b80db99e23a530f5652d69d4.zip
Merge 0.10->trunk
Diffstat (limited to 'util/dataforms.lua')
-rw-r--r--util/dataforms.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua
index 05846ab3..79b4d1a4 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -118,6 +118,7 @@ local field_readers = {};
function form_t.data(layout, stanza)
local data = {};
local errors = {};
+ local present = {};
for _, field in ipairs(layout) do
local tag;
@@ -133,6 +134,7 @@ function form_t.data(layout, stanza)
errors[field.name] = "Required value missing";
end
else
+ present[field.name] = true;
local reader = field_readers[field.type];
if reader then
data[field.name], errors[field.name] = reader(tag, field.required);
@@ -140,9 +142,9 @@ function form_t.data(layout, stanza)
end
end
if next(errors) then
- return data, errors;
+ return data, errors, present;
end
- return data;
+ return data, nil, present;
end
local function simple_text(field_tag, required)