Mercurial > prosody-modules
comparison mod_rest/jsonmap.lib.lua @ 3859:da3a0f055526
mod_rest: Fix handling of 'node' attribute in disco#info
This way also ensures it's covered by type checks in util.stanza
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jan 2020 02:03:30 +0100 |
parents | 8bdb1729529b |
children | 9752a6f1b9f3 |
comparison
equal
deleted
inserted
replaced
3858:29c39876c4af | 3859:da3a0f055526 |
---|---|
75 end | 75 end |
76 end | 76 end |
77 return { node = s.attr.node, identities = identities, features = features, }; | 77 return { node = s.attr.node, identities = identities, features = features, }; |
78 end; | 78 end; |
79 function (s) | 79 function (s) |
80 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }); | |
81 if type(s) == "table" then | 80 if type(s) == "table" then |
82 disco.attr.node = tostring(s.node); | 81 local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", node = s.node }); |
83 if s.identities then | 82 if s.identities then |
84 for _, identity in ipairs(s.identities) do | 83 for _, identity in ipairs(s.identities) do |
85 disco:tag("identity", { category = identity.category, type = identity.type, name = identity.name }):up(); | 84 disco:tag("identity", { category = identity.category, type = identity.type, name = identity.name }):up(); |
86 end | 85 end |
87 end | 86 end |
88 if s.features then | 87 if s.features then |
89 for _, feature in ipairs(s.features) do | 88 for _, feature in ipairs(s.features) do |
90 disco:tag("feature", { var = feature }):up(); | 89 disco:tag("feature", { var = feature }):up(); |
91 end | 90 end |
92 end | 91 end |
93 end | 92 return disco; |
94 return disco; | 93 else |
94 st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", }); | |
95 end | |
95 end; | 96 end; |
96 }; | 97 }; |
97 | 98 |
98 items = { | 99 items = { |
99 "func", "http://jabber.org/protocol/disco#items", "query", | 100 "func", "http://jabber.org/protocol/disco#items", "query", |