aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-12-09 22:17:28 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-12-09 22:17:28 +0500
commit8a68aeb9bfc79c05fb6140194c90562eb0a067d0 (patch)
tree3dc44d8ee58887896ca0aafa47de79fb935273f2 /plugins
parent8489bc8be166199ddd11ab9d71819ea062c41f48 (diff)
downloadprosody-8a68aeb9bfc79c05fb6140194c90562eb0a067d0.tar.gz
prosody-8a68aeb9bfc79c05fb6140194c90562eb0a067d0.zip
mod_console: Removed redundant code for host:activate() and host:deactivate(), now that hostmanager has error checking.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_console.lua25
1 files changed, 3 insertions, 22 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index c84cd5ac..712e9eb7 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -604,31 +604,12 @@ function def_env.s2s:close(from, to)
end
def_env.host = {}; def_env.hosts = def_env.host;
+
function def_env.host:activate(hostname, config)
- local hostmanager_activate = require "core.hostmanager".activate;
- if hosts[hostname] then
- return false, "The host "..tostring(hostname).." is already activated";
- end
-
- local defined_hosts = config or configmanager.getconfig();
- if not config and not defined_hosts[hostname] then
- return false, "Couldn't find "..tostring(hostname).." defined in the config, perhaps you need to config:reload()?";
- end
- hostmanager_activate(hostname, config or defined_hosts[hostname]);
- return true, "Host "..tostring(hostname).." activated";
+ return hostmanager.activate(hostname, config);
end
-
function def_env.host:deactivate(hostname, reason)
- local hostmanager_deactivate = require "core.hostmanager".deactivate;
- local host = hosts[hostname];
- if not host then
- return false, "The host "..tostring(hostname).." is not activated";
- end
- if reason then
- reason = { condition = "host-gone", text = reason };
- end
- hostmanager_deactivate(hostname, reason);
- return true, "Host "..tostring(hostname).." deactivated";
+ return hostmanager.deactivate(hostname, reason);
end
function def_env.host:list()