aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-28 02:46:36 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-28 02:46:36 +0100
commitfc9b65727f9c551518e6b2c9844f45a36b2bcabc (patch)
treee490c9abb4f0760fe41fa47a6a377be288eeabc3 /plugins
parent29169a015f67d31329fdb23ace68caaff118e316 (diff)
downloadprosody-fc9b65727f9c551518e6b2c9844f45a36b2bcabc.tar.gz
prosody-fc9b65727f9c551518e6b2c9844f45a36b2bcabc.zip
mod_console: Reload/unload a module on a component host if it is loaded there
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_console.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index 9be37db4..0f2c6711 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -162,7 +162,7 @@ end
def_env.module = {};
-local function get_hosts_set(hosts)
+local function get_hosts_set(hosts, module)
if type(hosts) == "table" then
if hosts[1] then
return set.new(hosts);
@@ -172,8 +172,9 @@ local function get_hosts_set(hosts)
elseif type(hosts) == "string" then
return set.new { hosts };
elseif hosts == nil then
+ local mm = require "modulemanager";
return set.new(array.collect(keys(prosody.hosts)))
- / function (host) return prosody.hosts[host].type == "local"; end;
+ / function (host) return prosody.hosts[host].type == "local" or module and mm.is_loaded(host, module); end;
end
end
@@ -203,7 +204,7 @@ end
function def_env.module:unload(name, hosts)
local mm = require "modulemanager";
- hosts = get_hosts_set(hosts);
+ hosts = get_hosts_set(hosts, name);
-- Unload the module for each host
local ok, err, count = true, nil, 0;
@@ -225,7 +226,7 @@ end
function def_env.module:reload(name, hosts)
local mm = require "modulemanager";
- hosts = get_hosts_set(hosts);
+ hosts = get_hosts_set(hosts, name);
-- Reload the module for each host
local ok, err, count = true, nil, 0;