Software /
code /
prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 4731:d71beacaec3b
mod_rest: Apply JSON mapping to items in <xmpp> container (e.g. MAM results etc)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 27 Oct 2021 20:43:17 +0200 |
parent | 4525:b68b801ddc50 |
child | 4732:607cac9b9393 |
comparison
equal
deleted
inserted
replaced
4730:1da4b815d2fe | 4731:d71beacaec3b |
---|---|
404 subscribe = "presence", unsubscribe = "presence", | 404 subscribe = "presence", unsubscribe = "presence", |
405 subscribed = "presence", unsubscribed = "presence", | 405 subscribed = "presence", unsubscribed = "presence", |
406 } | 406 } |
407 | 407 |
408 local function st2json(s) | 408 local function st2json(s) |
409 if s.name == "xmpp" then | |
410 local result = array(); | |
411 for child in s:childtags() do | |
412 result:push(st2json(child)); | |
413 end | |
414 return { xmpp = result }; | |
415 end | |
409 local t = map.parse(schema.properties[s.name], s); | 416 local t = map.parse(schema.properties[s.name], s); |
410 | 417 |
411 t.kind = s.name; | 418 t.kind = s.name; |
412 | 419 |
413 if s.name == "presence" and not s.attr.type then | 420 if s.name == "presence" and not s.attr.type then |