Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 8922:47d318eeff8d
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 22 Jun 2018 13:21:42 +0100 |
parent | 8876:9e72e63819dc |
parent | 8921:1c2925376315 |
child | 8964:76780f37028d |
comparison
equal
deleted
inserted
replaced
8920:2eaa442d81a6 | 8922:47d318eeff8d |
---|---|
10 | 10 |
11 local hostmanager = require "core.hostmanager"; | 11 local hostmanager = require "core.hostmanager"; |
12 local modulemanager = require "core.modulemanager"; | 12 local modulemanager = require "core.modulemanager"; |
13 local s2smanager = require "core.s2smanager"; | 13 local s2smanager = require "core.s2smanager"; |
14 local portmanager = require "core.portmanager"; | 14 local portmanager = require "core.portmanager"; |
15 local helpers = require "util.helpers"; | |
15 | 16 |
16 local _G = _G; | 17 local _G = _G; |
17 | 18 |
18 local prosody = _G.prosody; | 19 local prosody = _G.prosody; |
19 local hosts = prosody.hosts; | 20 local hosts = prosody.hosts; |
1166 print("HTTP requests to unknown hosts will be handled by "..default_host); | 1167 print("HTTP requests to unknown hosts will be handled by "..default_host); |
1167 end | 1168 end |
1168 return true; | 1169 return true; |
1169 end | 1170 end |
1170 | 1171 |
1172 def_env.debug = {}; | |
1173 | |
1174 function def_env.debug:logevents(host) | |
1175 helpers.log_host_events(host); | |
1176 return true; | |
1177 end | |
1178 | |
1179 function def_env.debug:events(host, event) | |
1180 local events_obj; | |
1181 if host and host ~= "*" then | |
1182 if not hosts[host] then | |
1183 return false, "Unknown host: "..host; | |
1184 end | |
1185 events_obj = hosts[host].events; | |
1186 else | |
1187 events_obj = prosody.events; | |
1188 end | |
1189 return true, helpers.show_events(events_obj, event); | |
1190 end | |
1191 | |
1171 module:hook("server-stopping", function(event) | 1192 module:hook("server-stopping", function(event) |
1172 for conn, session in pairs(sessions) do | 1193 for conn, session in pairs(sessions) do |
1173 session.print("Shutting down: "..(event.reason or "unknown reason")); | 1194 session.print("Shutting down: "..(event.reason or "unknown reason")); |
1174 end | 1195 end |
1175 end); | 1196 end); |