Mercurial > prosody-modules
diff mod_rest/jsonmap.lib.lua @ 3907:d5ecb9b9cb3b
mod_rest: Update with namespace and name of XEP-0432
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 25 Feb 2020 23:33:55 +0100 |
parents | dbebc9226597 |
children | 1df4900bbd29 |
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua Tue Feb 25 23:30:07 2020 +0100 +++ b/mod_rest/jsonmap.lib.lua Tue Feb 25 23:33:55 2020 +0100 @@ -316,8 +316,8 @@ end; }; - -- XEP-XXXX: User-defined Data Transfer - payload = { type = "func", xmlns = "urn:xmpp:udt:0", tagname = "payload", + -- XEP-0432: Simple JSON Messaging + payload = { type = "func", xmlns = "urn:xmpp:json-msg:0", tagname = "payload", st2json = function (s) local rawjson = s:get_child_text("json", "urn:xmpp:json:0"); if not rawjson then return nil, "missing-json-payload"; end @@ -330,7 +330,7 @@ end; json2st = function (s) if type(s) == "table" then - return st.stanza("payload", { xmlns = "urn:xmpp:udt:0", datatype = s.datatype }) + return st.stanza("payload", { xmlns = "urn:xmpp:json-msg:0", datatype = s.datatype }) :tag("json", { xmlns = "urn:xmpp:json:0" }):text(json.encode(s.data)); end; end