projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge Zash->trunk
[prosody.git]
/
util
/
dataforms.lua
diff --git
a/util/dataforms.lua
b/util/dataforms.lua
index 5626172e15fc614e62ab99d568b32c4e684b8a9b..5a3b1fb5652c969fb1cc5e329dcae8dbca04613d 100644
(file)
--- a/
util/dataforms.lua
+++ b/
util/dataforms.lua
@@
-1,6
+1,6
@@
-- Prosody IM
-- Prosody IM
--- Copyright (C) 2008-20
09
Matthew Wild
--- Copyright (C) 2008-20
09
Waqas Hussain
+-- Copyright (C) 2008-20
10
Matthew Wild
+-- Copyright (C) 2008-20
10
Waqas Hussain
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
@@
-23,8
+23,8
@@
function new(layout)
return setmetatable(layout, form_mt);
end
return setmetatable(layout, form_mt);
end
-function form_t.form(layout, data)
- local form = st.stanza("x", { xmlns = xmlns_forms, type = "form" });
+function form_t.form(layout, data
, formtype
)
+ local form = st.stanza("x", { xmlns = xmlns_forms, type =
formtype or
"form" });
if layout.title then
form:tag("title"):text(layout.title):up();
end
if layout.title then
form:tag("title"):text(layout.title):up();
end
@@
-93,7
+93,13
@@
function form_t.data(layout, stanza)
local data = {};
for field_tag in stanza:childtags() do
local data = {};
for field_tag in stanza:childtags() do
- local field_type = field_tag.attr.type;
+ local field_type;
+ for n, field in ipairs(layout) do
+ if field.name == field_tag.attr.var then
+ field_type = field.type;
+ break;
+ end
+ end
local reader = field_readers[field_type];
if reader then
local reader = field_readers[field_type];
if reader then