Comparison

mod_rest/jsonmap.lib.lua @ 4499:8e644bf36627

mod_rest: Change OOB namespace to the one used in messages Because of it's current popularity as companion to HTTP Upload this is probably more useful than the iq one.
author Kim Alvefur <zash@zash.se>
date Sun, 07 Mar 2021 01:26:20 +0100
parent 4473:3b50a9a75fb6
child 4500:34c0f760f34a
comparison
equal deleted inserted replaced
4498:1776831d0fab 4499:8e644bf36627
226 -- else .. missing required attribute 226 -- else .. missing required attribute
227 end; 227 end;
228 }; 228 };
229 229
230 -- XEP-0066: Out of Band Data 230 -- XEP-0066: Out of Band Data
231 oob_url = { type = "func", xmlns = "jabber:iq:oob", tagname = "query", 231 oob_url = { type = "func", xmlns = "jabber:x:oob", tagname = "query",
232 -- XXX namespace depends on whether it's in an iq or message stanza
232 st2json = function (s) 233 st2json = function (s)
233 return s:get_child_text("url"); 234 return s:get_child_text("url");
234 end; 235 end;
235 json2st = function (s) 236 json2st = function (s)
236 if type(s) == "string" then 237 if type(s) == "string" then
237 return st.stanza("query", { xmlns = "jabber:iq:oob" }):text_tag("url", s); 238 return st.stanza("query", { xmlns = "jabber:x:oob" }):text_tag("url", s);
238 end 239 end
239 end; 240 end;
240 }; 241 };
241 242
242 -- XEP-0432: Simple JSON Messaging 243 -- XEP-0432: Simple JSON Messaging