Mercurial > prosody-modules
changeset 3852:66f96b98d219
mod_rest: Allow returning an array of JID strings as disco#items
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jan 2020 00:30:14 +0100 |
parents | 8dbca6a93988 |
children | fb29d7cd698b |
files | mod_rest/jsonmap.lib.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;