Software /
code /
prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 3854:25c34c9f755c
mod_rest: Add mapping of XEP-0092: Software Version
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jan 2020 00:40:38 +0100 |
parent | 3852:66f96b98d219 |
child | 3855:0e1e900577c4 |
comparison
equal
deleted
inserted
replaced
3853:fb29d7cd698b | 3854:25c34c9f755c |
---|---|
38 end; | 38 end; |
39 }; | 39 }; |
40 | 40 |
41 -- XEP-0199 | 41 -- XEP-0199 |
42 ping = {"bool_tag", "urn:xmpp:ping", "ping"}, | 42 ping = {"bool_tag", "urn:xmpp:ping", "ping"}, |
43 | |
44 -- XEP-0092: Software Version | |
45 version = {"func", "jabber:iq:version", "query", | |
46 function (s) | |
47 return { | |
48 name = s:get_child_text("name"); | |
49 version = s:get_child_text("version"); | |
50 os = s:get_child_text("os"); | |
51 } | |
52 end, | |
53 function (s) | |
54 local v = st.stanza("query", { xmlns = "jabber:iq:version" }); | |
55 if type(s) == "table" then | |
56 v:text_tag("name", s.name); | |
57 v:text_tag("version", s.version); | |
58 if s.os then | |
59 v:text_tag("os", s.os); | |
60 end | |
61 end | |
62 return v; | |
63 end | |
64 }; | |
43 | 65 |
44 -- XEP-0030 | 66 -- XEP-0030 |
45 disco = { | 67 disco = { |
46 "func", "http://jabber.org/protocol/disco#info", "query", | 68 "func", "http://jabber.org/protocol/disco#info", "query", |
47 function (s) --> array of features | 69 function (s) --> array of features |
133 | 155 |
134 local implied_kinds = { | 156 local implied_kinds = { |
135 disco = "iq", | 157 disco = "iq", |
136 items = "iq", | 158 items = "iq", |
137 ping = "iq", | 159 ping = "iq", |
160 version = "iq", | |
138 | 161 |
139 body = "message", | 162 body = "message", |
140 html = "message", | 163 html = "message", |
141 replace = "message", | 164 replace = "message", |
142 state = "message", | 165 state = "message", |