aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-21 20:52:12 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-21 20:52:12 +0100
commit89fb66dabbceb336e9e78d8f2e13c39f67f14eec (patch)
tree3c5fad30c3b8f8aa75f7e6175272712d88a8da05 /plugins/mod_admin_telnet.lua
parent785fcb0ee39111f31aaa0ebd0d00a797108b6c68 (diff)
downloadprosody-89fb66dabbceb336e9e78d8f2e13c39f67f14eec.tar.gz
prosody-89fb66dabbceb336e9e78d8f2e13c39f67f14eec.zip
mod_admin_telnet: module:load(): Fix 'global-module-already-loaded' errors when successfully loading a global module (fixes #228)
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 412e1e62..cb6302c7 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -292,16 +292,22 @@ function def_env.module:load(name, hosts, config)
hosts = get_hosts_set(hosts);
-- Load the module for each host
- local ok, err, count = true, nil, 0;
+ local ok, err, count, mod = true, nil, 0, nil;
for host in hosts do
if (not mm.is_loaded(host, name)) then
- ok, err = mm.load(host, name, config);
- if not ok then
+ mod, err = mm.load(host, name, config);
+ if not mod then
ok = false;
+ if err == "global-module-already-loaded" then
+ if count > 0 then
+ ok, err, count = true, nil, 1;
+ end
+ break;
+ end
self.session.print(err or "Unknown error loading module");
else
count = count + 1;
- self.session.print("Loaded for "..host);
+ self.session.print("Loaded for "..mod.module.host);
end
end
end