Software /
code /
prosody-modules
Comparison
mod_admin_web/admin_web/mod_admin_web.lua @ 304:8f3499ae1e27
mod_admin_web: Fix initialisation code, undeclared variable and wrong event scope
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 27 Dec 2010 15:07:16 +0000 |
parent | 303:0f53c88bab9a |
child | 309:5ec9125575fc |
comparison
equal
deleted
inserted
replaced
303:0f53c88bab9a | 304:8f3499ae1e27 |
---|---|
146 path = path:gsub("^/[^/]+", ""); -- Strip /admin/ | 146 path = path:gsub("^/[^/]+", ""); -- Strip /admin/ |
147 return serve_file(path); | 147 return serve_file(path); |
148 end | 148 end |
149 | 149 |
150 function module.load() | 150 function module.load() |
151 local http_conf = config.get("*", "core", "webadmin_http_ports"); | |
152 | |
153 httpserver.new_from_config(http_conf, handle_file_request, { base = "admin" }); | |
154 end | |
155 | |
156 prosody.events.add_handler("server-started", function () | |
151 local host_session = prosody.hosts[host]; | 157 local host_session = prosody.hosts[host]; |
152 local http_conf = config.get("*", "core", "webadmin_http_ports"); | |
153 | |
154 httpserver.new_from_config(http_conf, handle_file_request, { base = "admin" }); | |
155 end | |
156 | |
157 module:hook("server-started", function () | |
158 if not select(2, hosts[service].modules.pubsub.service:get_nodes(service))[xmlns_s2s_session] then | 158 if not select(2, hosts[service].modules.pubsub.service:get_nodes(service))[xmlns_s2s_session] then |
159 local ok, errmsg = hosts[service].modules.pubsub.service:create(xmlns_s2s_session, service); | 159 local ok, errmsg = hosts[service].modules.pubsub.service:create(xmlns_s2s_session, service); |
160 if not ok then | 160 if not ok then |
161 module:log("warn", "Could not create node " .. xmlns_s2s_session .. ": " .. tostring(errmsg)); | 161 module:log("warn", "Could not create node " .. xmlns_s2s_session .. ": " .. tostring(errmsg)); |
162 end | 162 end |