mod_console: Add module:list() command to show modules loaded on a host
authorMatthew Wild <mwild1@gmail.com>
Mon, 5 Oct 2009 13:40:01 +0000 (14:40 +0100)
committerMatthew Wild <mwild1@gmail.com>
Mon, 5 Oct 2009 13:40:01 +0000 (14:40 +0100)
plugins/mod_console.lua

index 43cb8b133e3722acf52250ce368ef36f49ae528f..112d24929c6d9c0de6de794b730e7dcd16ae202e 100644 (file)
@@ -70,9 +70,6 @@ function console_listener.listener(conn, data)
                        if data:match("^>") then
                                data = data:gsub("^>", "");
                                useglobalenv = true;
-                       elseif data == "\004" then
-                               commands["bye"](session, data);
-                               return;
                        else
                                local command = data:lower();
                                command = data:match("^%w+") or data:match("%p");
@@ -183,7 +180,6 @@ function commands.help(session, data)
                print [[module:load(module, host) - Load the specified module on the specified host (or all hosts if none given)]]
                print [[module:reload(module, host) - The same, but unloads and loads the module (saving state if the module supports it)]]
                print [[module:unload(module, host) - The same, but just unloads the module from memory]]
-               print [[module:list(host) - List the modules loaded on the specified host]]
        elseif section == "server" then
                print [[server:version() - Show the server's version number]]
                print [[server:uptime() - Show how long the server has been running]]
@@ -209,8 +205,7 @@ end
 -- Anything in def_env will be accessible within the session as a global variable
 
 def_env.server = {};
-
-function def_env.server:insane_reload()
+function def_env.server:reload()
        prosody.unlock_globals();
        dofile "prosody"
        prosody = _G.prosody;
@@ -235,11 +230,6 @@ 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)
@@ -368,11 +358,6 @@ 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
@@ -399,12 +384,7 @@ end
 
 function def_env.c2s:show(match_jid)
        local print, count = self.session.print, 0;
-       local curr_host;
        show_c2s(function (jid, session)
-               if curr_host ~= session.host then
-                       curr_host = session.host;
-                       print(curr_host);
-               end
                if (not match_jid) or jid:match(match_jid) then
                        count = count + 1;
                        local status, priority = "unavailable", tostring(session.priority or "-");
@@ -416,7 +396,7 @@ function def_env.c2s:show(match_jid)
                                        status = "available";
                                end
                        end
-                       print("   "..jid.." - "..status.."("..priority..")");
+                       print(jid.." - "..status.."("..priority..")");
                end             
        end);
        return true, "Total: "..count.." clients";
@@ -467,7 +447,7 @@ function def_env.s2s:show(match_jid)
                for remotehost, session in pairs(host_session.s2sout) do
                        if (not match_jid) or remotehost:match(match_jid) or host:match(match_jid) then
                                count_out = count_out + 1;
-                               print("    "..host.." -> "..remotehost..(session.secure and "(encrypted)" or ""));
+                               print("    "..host.." -> "..remotehost);
                                if session.sendq then
                                        print("        There are "..#session.sendq.." queued outgoing stanzas for this connection");
                                end
@@ -500,7 +480,7 @@ function def_env.s2s:show(match_jid)
                        if session.to_host == host and ((not match_jid) or host:match(match_jid) 
                                or (session.from_host and session.from_host:match(match_jid))) then
                                count_in = count_in + 1;
-                               print("    "..host.." <- "..(session.from_host or "(unknown)")..(session.secure and "(encrypted)" or ""));
+                               print("    "..host.." <- "..(session.from_host or "(unknown)"));
                                if session.type == "s2sin_unauthed" then
                                                print("        Connection not yet authenticated");
                                end