aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-06-22 13:20:38 +0100
committerMatthew Wild <mwild1@gmail.com>2018-06-22 13:20:38 +0100
commitdb6b2ff8f9fbb72bfa08cd5a6ff91abd30bbfe1c (patch)
tree11fb0de7077b194ae6221d63b387026d602fc061 /plugins/mod_admin_telnet.lua
parentbe56bd2bd5fb2c2a21901d7cccdde0203c3f52bc (diff)
downloadprosody-db6b2ff8f9fbb72bfa08cd5a6ff91abd30bbfe1c.tar.gz
prosody-db6b2ff8f9fbb72bfa08cd5a6ff91abd30bbfe1c.zip
mod_admin_telnet: Add debug:events() and debug:logevents()
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 9d0e4c74..5e8d8534 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -12,6 +12,7 @@ local hostmanager = require "core.hostmanager";
local modulemanager = require "core.modulemanager";
local s2smanager = require "core.s2smanager";
local portmanager = require "core.portmanager";
+local helpers = require "util.helpers";
local _G = _G;
@@ -1130,6 +1131,26 @@ function def_env.http:list()
return true;
end
+def_env.debug = {};
+
+function def_env.debug:logevents(host)
+ helpers.log_host_events(host);
+ return true;
+end
+
+function def_env.debug:events(host, event)
+ local events_obj;
+ if host and host ~= "*" then
+ if not hosts[host] then
+ return false, "Unknown host: "..host;
+ end
+ events_obj = hosts[host].events;
+ else
+ events_obj = prosody.events;
+ end
+ return true, helpers.show_events(events_obj, event);
+end
+
module:hook("server-stopping", function(event)
for conn, session in pairs(sessions) do
session.print("Shutting down: "..(event.reason or "unknown reason"));