mod_rest: Fix handling of 'node' attribute in disco#info
This way also ensures it's covered by type checks in util.stanza
--- a/mod_rest/jsonmap.lib.lua Sat Jan 25 01:55:23 2020 +0100
+++ b/mod_rest/jsonmap.lib.lua Sat Jan 25 02:03:30 2020 +0100
@@ -77,9 +77,8 @@
return { node = s.attr.node, identities = identities, features = features, };
end;
function (s)
- local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" });
if type(s) == "table" then
- disco.attr.node = tostring(s.node);
+ local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", node = s.node });
if s.identities then
for _, identity in ipairs(s.identities) do
disco:tag("identity", { category = identity.category, type = identity.type, name = identity.name }):up();
@@ -90,8 +89,10 @@
disco:tag("feature", { var = feature }):up();
end
end
+ return disco;
+ else
+ st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", });
end
- return disco;
end;
};