equal
deleted
inserted
replaced
9 module:add_feature(xmlns_extdisco_2); |
9 module:add_feature(xmlns_extdisco_2); |
10 |
10 |
11 local function handle_services(event) |
11 local function handle_services(event) |
12 local origin, stanza = event.origin, event.stanza; |
12 local origin, stanza = event.origin, event.stanza; |
13 local service = stanza.tags[1]; |
13 local service = stanza.tags[1]; |
14 local service_type = service and service.attr.type; |
14 local service_type = service.attr.type; |
15 local reply = st.reply(stanza):tag("services", { xmlns = service.attr.xmlns }); |
15 local reply = st.reply(stanza):tag("services", { xmlns = service.attr.xmlns }); |
16 for host, service_info in pairs(services) do |
16 for host, service_info in pairs(services) do |
17 if not(service_type) or service_info.type == service_type then |
17 if not(service_type) or service_info.type == service_type then |
18 reply:tag("service", { |
18 reply:tag("service", { |
19 host = host; |
19 host = host; |
32 module:hook("iq-get/host/"..xmlns_extdisco_2..":services", handle_services); |
32 module:hook("iq-get/host/"..xmlns_extdisco_2..":services", handle_services); |
33 |
33 |
34 local function handle_credentials(event) |
34 local function handle_credentials(event) |
35 local origin, stanza = event.origin, event.stanza; |
35 local origin, stanza = event.origin, event.stanza; |
36 local credentials = stanza.tags[1]; |
36 local credentials = stanza.tags[1]; |
37 local host = credentials and credentials.attr.host; |
37 local host = credentials.attr.host; |
38 if not host then |
38 if not host then |
39 origin.send(st.error_reply(stanza, "cancel", "bad-request", "No host specified")); |
39 origin.send(st.error_reply(stanza, "cancel", "bad-request", "No host specified")); |
40 return true; |
40 return true; |
41 end |
41 end |
42 local service_info = services[host]; |
42 local service_info = services[host]; |