aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_console.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_console.lua')
-rw-r--r--plugins/mod_console.lua26
1 files changed, 23 insertions, 3 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index a3ed9499..3a18ec0e 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -205,7 +205,8 @@ end
-- Anything in def_env will be accessible within the session as a global variable
def_env.server = {};
-function def_env.server:reload()
+
+function def_env.server:insane_reload()
prosody.unlock_globals();
dofile "prosody"
prosody = _G.prosody;
@@ -230,6 +231,11 @@ function def_env.server:uptime()
minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
end
+function def_env.server:shutdown(reason)
+ prosody.shutdown(reason);
+ return true, "Shutdown initiated";
+end
+
def_env.module = {};
local function get_hosts_set(hosts, module)
@@ -333,6 +339,11 @@ function def_env.config:get(host, section, key)
return true, tostring(config_get(host, section, key));
end
+function def_env.config:reload()
+ local ok, err = prosody.reload_config();
+ return ok, (ok and "Config reloaded (you may need to reload modules to take effect)") or tostring(err);
+end
+
def_env.hosts = {};
function def_env.hosts:list()
for host, host_session in pairs(hosts) do
@@ -359,10 +370,19 @@ end
function def_env.c2s:show(match_jid)
local print, count = self.session.print, 0;
- show_c2s(function (jid)
+ show_c2s(function (jid, session)
if (not match_jid) or jid:match(match_jid) then
count = count + 1;
- print(jid);
+ local status, priority = "unavailable", tostring(session.priority or "-");
+ if session.presence then
+ status = session.presence:child_with_name("show");
+ if status then
+ status = status:get_text() or "[invalid!]";
+ else
+ status = "available";
+ end
+ end
+ print(jid.." - "..status.."("..priority..")");
end
end);
return true, "Total: "..count.." clients";