Software /
code /
prosody-modules
Changeset
3881:5d7df207dc2b
mod_rest: Add final pieces of XEP-0050 (actions, note, form)
Forgot to add in a previous commit.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 04 Feb 2020 23:05:43 +0100 |
parents | 3880:44c2d36c40a4 |
children | 3882:3b8f4f3b1718 |
files | mod_rest/jsonmap.lib.lua |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua Tue Feb 04 22:34:19 2020 +0100 +++ b/mod_rest/jsonmap.lib.lua Tue Feb 04 23:05:43 2020 +0100 @@ -250,6 +250,26 @@ sessionid = s.sessionid, status = s.status, }); + if type(s.actions) == "table" then + cmd:tag("actions", { execute = s.actions.execute }); + do + if s.actions.next == true then + cmd:tag("next"):up(); + end + if s.actions.prev == true then + cmd:tag("prev"):up(); + end + if s.actions.complete == true then + cmd:tag("complete"):up(); + end + end + cmd:up(); + elseif type(s.note) == "table" then + cmd:text_tag("note", s.note.text, { type = s.note.type }); + end + if s.form then + cmd:add_child(dataform[5](s.form)); + end return cmd; elseif type(s) == "string" then -- assume node return st.stanza("command", { xmlns = "http://jabber.org/protocol/commands", node = s });