Mercurial > prosody-modules
comparison mod_extdisco/mod_extdisco.lua @ 3602:e302537a0e4e
xep-0215-0.6 requires service to be wrapped in services tag.
author | Alexey Bobyr |
---|---|
date | Thu, 23 May 2019 09:15:17 +0300 |
parents | e5c16c87383c |
children | ec1d25ae6206 |
comparison
equal
deleted
inserted
replaced
3601:013ef96a6d4d | 3602:e302537a0e4e |
---|---|
8 | 8 |
9 module:hook("iq-get/host/"..xmlns_extdisco..":services", function (event) | 9 module:hook("iq-get/host/"..xmlns_extdisco..":services", function (event) |
10 local origin, stanza = event.origin, event.stanza; | 10 local origin, stanza = event.origin, event.stanza; |
11 local service = stanza:get_child("service", xmlns_extdisco); | 11 local service = stanza:get_child("service", xmlns_extdisco); |
12 local service_type = service and service.attr.type; | 12 local service_type = service and service.attr.type; |
13 local reply = st.reply(stanza); | 13 local reply = st.reply(stanza):tag('services', { xmlns = 'urn:xmpp:extdisco:1' }); |
14 for host, service_info in pairs(services) do | 14 for host, service_info in pairs(services) do |
15 if not(service_type) or service_info.type == service_type then | 15 if not(service_type) or service_info.type == service_type then |
16 reply:tag("service", { | 16 reply:tag("service", { |
17 host = host; | 17 host = host; |
18 port = service_info.port; | 18 port = service_info.port; |