comparison mod_rest/jsonmap.lib.lua @ 3822:f0a1d113dce4

mod_rest: Add support for mapping 'node' attr in disco#info
author Kim Alvefur <zash@zash.se>
date Thu, 02 Jan 2020 09:28:18 +0100
parents 1bab6f67eb5f
children 31b1797a78e1
comparison
equal deleted inserted replaced
3821:11272a3233ce 3822:f0a1d113dce4
50 identities:push({ category = tag.attr.category, type = tag.attr.type, name = tag.attr.name }); 50 identities:push({ category = tag.attr.category, type = tag.attr.type, name = tag.attr.name });
51 elseif tag.name == "feature" and tag.attr.var then 51 elseif tag.name == "feature" and tag.attr.var then
52 features:push(tag.attr.var); 52 features:push(tag.attr.var);
53 end 53 end
54 end 54 end
55 return { identities = identities, features = features, }; 55 return { node = s.attr.node, identities = identities, features = features, };
56 end; 56 end;
57 function (s) 57 function (s)
58 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }); 58 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" });
59 if type(s) == "table" then 59 if type(s) == "table" then
60 disco.attr.node = tostring(s.node);
60 if s.identities then 61 if s.identities then
61 for identity in ipairs(s.identities) do 62 for identity in ipairs(s.identities) do
62 disco:tag("identity", { category = identity[1], type = identity[2] }):up(); 63 disco:tag("identity", { category = identity[1], type = identity[2] }):up();
63 end 64 end
64 end 65 end