# HG changeset patch # User Kim Alvefur # Date 1579908614 -3600 # Node ID 66f96b98d2193e5e8d8c0abb231519c0d6f9cd1e # Parent 8dbca6a93988862d784ffff257d72a409596088f mod_rest: Allow returning an array of JID strings as disco#items diff -r 8dbca6a93988 -r 66f96b98d219 mod_rest/jsonmap.lib.lua --- a/mod_rest/jsonmap.lib.lua Sat Jan 25 00:29:34 2020 +0100 +++ b/mod_rest/jsonmap.lib.lua Sat Jan 25 00:30:14 2020 +0100 @@ -87,7 +87,11 @@ local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#items" }); if type(s) == "table" then for _, item in ipairs(s) do - disco:tag("item", { jid = item.jid, node = item.node, name = item.name }); + if type(item) == "string" then + disco:tag("item", { jid = item }); + elseif type(item) == "table" then + disco:tag("item", { jid = item.jid, node = item.node, name = item.name }); + end end end return disco;