Comparison

mod_rest/jsonmap.lib.lua @ 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
parent 3880:44c2d36c40a4
child 3885:1ec45dbc7db5
comparison
equal deleted inserted replaced
3880:44c2d36c40a4 3881:5d7df207dc2b
248 action = s.action, 248 action = s.action,
249 node = s.node, 249 node = s.node,
250 sessionid = s.sessionid, 250 sessionid = s.sessionid,
251 status = s.status, 251 status = s.status,
252 }); 252 });
253 if type(s.actions) == "table" then
254 cmd:tag("actions", { execute = s.actions.execute });
255 do
256 if s.actions.next == true then
257 cmd:tag("next"):up();
258 end
259 if s.actions.prev == true then
260 cmd:tag("prev"):up();
261 end
262 if s.actions.complete == true then
263 cmd:tag("complete"):up();
264 end
265 end
266 cmd:up();
267 elseif type(s.note) == "table" then
268 cmd:text_tag("note", s.note.text, { type = s.note.type });
269 end
270 if s.form then
271 cmd:add_child(dataform[5](s.form));
272 end
253 return cmd; 273 return cmd;
254 elseif type(s) == "string" then -- assume node 274 elseif type(s) == "string" then -- assume node
255 return st.stanza("command", { xmlns = "http://jabber.org/protocol/commands", node = s }); 275 return st.stanza("command", { xmlns = "http://jabber.org/protocol/commands", node = s });
256 end 276 end
257 -- else .. missing required attribute 277 -- else .. missing required attribute