Comparison

plugins/mod_admin_telnet.lua @ 6988:329d5fb8a9d3

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 Dec 2015 18:58:30 +0000
parent 6936:2ca1d54d4b92
parent 6987:06696882d972
child 7014:298bfc768889
comparison
equal deleted inserted replaced
6978:30c96a5db360 6988:329d5fb8a9d3
280 end 280 end
281 281
282 -- Session environment -- 282 -- Session environment --
283 -- Anything in def_env will be accessible within the session as a global variable 283 -- Anything in def_env will be accessible within the session as a global variable
284 284
285 --luacheck: ignore 212/self
286
285 def_env.server = {}; 287 def_env.server = {};
286 288
287 function def_env.server:insane_reload() 289 function def_env.server:insane_reload()
288 prosody.unlock_globals(); 290 prosody.unlock_globals();
289 dofile "prosody" 291 dofile "prosody"
1123 1125
1124 function def_env.dns:cache() 1126 function def_env.dns:cache()
1125 return true, "Cache:\n"..tostring(dns.cache()) 1127 return true, "Cache:\n"..tostring(dns.cache())
1126 end 1128 end
1127 1129
1130 def_env.http = {};
1131
1132 function def_env.http:list()
1133 local print = self.session.print;
1134
1135 for host in pairs(prosody.hosts) do
1136 local http_apps = modulemanager.get_items("http-provider", host);
1137 if #http_apps > 0 then
1138 local http_host = module:context(host):get_option("http_host");
1139 print("HTTP endpoints on "..host..(http_host and (" (using "..http_host.."):") or ":"));
1140 for _, provider in ipairs(http_apps) do
1141 local url = module:context(host):http_url(provider.name);
1142 print("", url);
1143 end
1144 print("");
1145 end
1146 end
1147
1148 local default_host = module:get_option("http_default_host");
1149 if not default_host then
1150 print("HTTP requests to unknown hosts will return 404 Not Found");
1151 else
1152 print("HTTP requests to unknown hosts will be handled by "..default_host);
1153 end
1154 return true;
1155 end
1156
1128 ------------- 1157 -------------
1129 1158
1130 function printbanner(session) 1159 function printbanner(session)
1131 local option = module:get_option("console_banner"); 1160 local option = module:get_option("console_banner");
1132 if option == nil or option == "full" or option == "graphic" then 1161 if option == nil or option == "full" or option == "graphic" then