Software /
code /
prosody
Diff
plugins/mod_console.lua @ 1433:e7bd00e70973
mod_console: Reload/unload a module on a component host if it is loaded there
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 28 Jun 2009 02:46:36 +0100 |
parent | 1342:947d94e3619f |
child | 1483:efd19cdda6ca |
line wrap: on
line diff
--- a/plugins/mod_console.lua Sat Jun 27 04:44:27 2009 +0100 +++ b/plugins/mod_console.lua Sun Jun 28 02:46:36 2009 +0100 @@ -162,7 +162,7 @@ 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 @@ 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 @@ 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 @@ 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;