annotate mod_xml_status/mod_xml_status.lua @ 536:09280dd0b22e

mod_register_json: replaced prosody.events.add_handler with module:hook.
author Marco Cirillo <maranda@lightwitch.org>
date Sun, 08 Jan 2012 03:53:09 +0000
parents 967ba17b1d2a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
1 -- (C) 2011, Marco Cirillo (LW.Org)
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
2 -- Display server stats in readable XML format
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
3
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
4 module:set_global()
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
5
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
6 local ports = module:get_option_array("xml_status_http_ports", {{ port = 5280 }})
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
7 local show_hosts = module:get_option_array("xml_status_show_hosts", nil)
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
8 local show_comps = module:get_option_array("xml_status_show_comps", nil)
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
9
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
10 local httpserver = require "net.httpserver"
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
11
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
12 -- code begin
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
13
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
14 if not prosody.stanza_counter and not show_hosts and not show_comps then
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
15 module:log ("error", "mod_xml_status requires at least one of the following things:")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
16 module:log ("error", "mod_stanza_counter loaded, or either xml_status_show_hosts or xml_status_show_comps configuration values set.")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
17 module:log ("error", "check the module wiki at: http://code.google.com/p/prosody-modules/wiki/mod_xml_status")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
18 return false
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
19 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
20
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
21 local r_err = "\n<html>\n<head>\n<title>Prosody's XML Status - Error %s</title>\n<meta name=\"robots\" content=\"noindex, nofollow\" />\n</head>\n\n<body>\n<h3>%s</h3>\n</body>\n\n</html>\n"
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
22
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
23 local response_table = {}
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
24 response_table.header = '<?xml version="1.0" encoding="UTF-8" ?>'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
25 response_table.doc_header = '<document>'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
26 response_table.doc_closure = '</document>'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
27 response_table.stanzas = {
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
28 elem_header = ' <stanzas>', elem_closure = ' </stanzas>',
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
29 incoming = ' <incoming iq="%d" message="%d" presence="%d" />',
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
30 outgoing = ' <outgoing iq="%d" message="%d" presence="%d" />'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
31 }
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
32 response_table.hosts = {
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
33 elem_header = ' <hosts>', elem_closure = ' </hosts>',
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
34 status = ' <status name="%s" current="%s" />'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
35 }
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
36 response_table.comps = {
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
37 elem_header = ' <components>', elem_closure = ' </components>',
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
38 status = ' <status name="%s" current="%s" />'
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
39 }
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
40
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
41 local function forge_response()
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
42 local hosts_s = {}; local components = {}; local stats = {}; local hosts_stats = {}; local comps_stats = {}
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
43
526
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
44 local function t_builder(t,r) for _, bstring in ipairs(t) do r[#r+1] = bstring end end
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
45
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
46 if show_hosts then t_builder(show_hosts, hosts_s) end
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
47 if show_comps then t_builder(show_comps, components) end
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
48
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
49 -- build stanza stats if there
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
50 if prosody.stanza_counter then
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
51 stats[1] = response_table.stanzas.elem_header
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
52 stats[2] = response_table.stanzas.incoming:format(prosody.stanza_counter.iq["incoming"],
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
53 prosody.stanza_counter.message["incoming"],
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
54 prosody.stanza_counter.presence["incoming"])
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
55 stats[3] = response_table.stanzas.outgoing:format(prosody.stanza_counter.iq["outgoing"],
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
56 prosody.stanza_counter.message["outgoing"],
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
57 prosody.stanza_counter.presence["outgoing"])
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
58 stats[4] = response_table.stanzas.elem_closure
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
59 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
60
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
61 -- build hosts stats if there
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
62 if hosts_s[1] then
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
63 hosts_stats[1] = response_table.hosts.elem_header
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
64 for _, name in ipairs(hosts_s) do
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
65 hosts_stats[#hosts_stats+1] = response_table.hosts.status:format(
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
66 name, hosts[name] and "online" or "offline")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
67 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
68 hosts_stats[#hosts_stats+1] = response_table.hosts.elem_closure
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
69 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
70
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
71 -- build components stats if there
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
72 if components[1] then
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
73 comps_stats[1] = response_table.comps.elem_header
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
74 for _, name in ipairs(components) do
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
75 comps_stats[#comps_stats+1] = response_table.comps.status:format(
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
76 name, hosts[name].modules.component and hosts[name].modules.component.connected and "online" or
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
77 hosts[name] and hosts[name].modules.component == nil and "online" or "offline")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
78 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
79 comps_stats[#comps_stats+1] = response_table.comps.elem_closure
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
80 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
81
526
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
82 -- build xml document
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
83 local result = {}
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
84 result[#result+1] = response_table.header; result[#result+1] = response_table.doc_header -- start
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
85 t_builder(stats, result); t_builder(hosts_stats, result); t_builder(comps_stats, result)
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
86 result[#result+1] = response_table.doc_closure -- end
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
87
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
88 return table.concat(result, "\n")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
89 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
90
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
91 -- http handlers
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
92
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
93 local function response(code, r, h)
532
967ba17b1d2a mod_xml_status: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents: 527
diff changeset
94 local response = { status = code, body = r }
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
95
532
967ba17b1d2a mod_xml_status: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents: 527
diff changeset
96 if h then response.headers = h end
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
97 return response
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
98 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
99
526
0529658efd1e mod_xml_status: last code cleanup and optimization.
Marco Cirillo <maranda@lightwitch.org>
parents: 525
diff changeset
100 local function request(method, body, request)
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
101 if method == "GET" then
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
102 return response(200, forge_response())
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
103 else
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
104 local err405 = r_err:format("405", "Only GET is supported")
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
105 return response(405, err405, {["Allow"] = "GET"})
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
106 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
107 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
108
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
109 -- initialization.
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
110 -- init http interface
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
111 local function setup()
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
112 httpserver.new_from_config(ports, request, { base = "xml-status" })
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
113 end
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
114
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
115 if prosody.start_time then
532
967ba17b1d2a mod_xml_status: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents: 527
diff changeset
116 setup()
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
117 else
532
967ba17b1d2a mod_xml_status: stick to one code "punctuation" style.
Marco Cirillo <maranda@lightwitch.org>
parents: 527
diff changeset
118 module:hook("server-started", setup)
524
ff3ea8735d61 mod_xml_status: initial commit. Expose server status in xml format to be used on external webapps.
Marco Cirillo <maranda@lightwitch.org>
parents:
diff changeset
119 end