comparison mod_rest/jsonmap.lib.lua @ 3850:8d13b9c9ba75

mod_rest: Fix disco#info identities data mapping It should now handle the same format it produces.
author Kim Alvefur <zash@zash.se>
date Sat, 25 Jan 2020 00:20:00 +0100
parents 11c34e97fe1a
children 8dbca6a93988
comparison
equal deleted inserted replaced
3849:11c34e97fe1a 3850:8d13b9c9ba75
59 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }); 59 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" });
60 if type(s) == "table" then 60 if type(s) == "table" then
61 disco.attr.node = tostring(s.node); 61 disco.attr.node = tostring(s.node);
62 if s.identities then 62 if s.identities then
63 for _, identity in ipairs(s.identities) do 63 for _, identity in ipairs(s.identities) do
64 disco:tag("identity", { category = identity[1], type = identity[2] }):up(); 64 disco:tag("identity", { category = identity.category, type = identity.type, name = identity.name }):up();
65 end 65 end
66 end 66 end
67 if s.features then 67 if s.features then
68 for _, feature in ipairs(s.features) do 68 for _, feature in ipairs(s.features) do
69 disco:tag("feature", { var = feature }):up(); 69 disco:tag("feature", { var = feature }):up();