Software /
code /
prosody
Changeset
8921:1c2925376315
mod_admin_telnet: Add debug:events() and debug:logevents()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 22 Jun 2018 13:20:38 +0100 |
parents | 8919:c46c2942b8fe |
children | 8922:47d318eeff8d 8947:f12cc1d7aa65 |
files | plugins/mod_admin_telnet.lua |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Sun Jun 17 20:02:40 2018 +0200 +++ b/plugins/mod_admin_telnet.lua Fri Jun 22 13:20:38 2018 +0100 @@ -12,6 +12,7 @@ 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 @@ 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"));