Comparison

plugins/mod_admin_telnet.lua @ 9454:6780049be177

mod_admin_telnet: Allow viewing HTTP event listeners via debug:events('http')
author Matthew Wild <mwild1@gmail.com>
date Tue, 09 Oct 2018 15:02:44 +0100
parent 9411:62c876e333e4
child 9691:e11e076f0eb8
child 10618:232841373711
comparison
equal deleted inserted replaced
9453:b6cdadb1175d 9454:6780049be177
1141 end 1141 end
1142 1142
1143 function def_env.debug:events(host, event) 1143 function def_env.debug:events(host, event)
1144 local events_obj; 1144 local events_obj;
1145 if host and host ~= "*" then 1145 if host and host ~= "*" then
1146 if not prosody.hosts[host] then 1146 if host == "http" then
1147 events_obj = require "net.http.server"._events;
1148 elseif not prosody.hosts[host] then
1147 return false, "Unknown host: "..host; 1149 return false, "Unknown host: "..host;
1148 end 1150 else
1149 events_obj = prosody.hosts[host].events; 1151 events_obj = prosody.hosts[host].events;
1152 end
1150 else 1153 else
1151 events_obj = prosody.events; 1154 events_obj = prosody.events;
1152 end 1155 end
1153 return true, helpers.show_events(events_obj, event); 1156 return true, helpers.show_events(events_obj, event);
1154 end 1157 end