Software /
code /
prosody
Changeset
3840:abcbce5e4240
mod_console: Removed redundant code for host:activate() and host:deactivate(), now that hostmanager has error checking.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 09 Dec 2010 22:17:28 +0500 |
parents | 3839:f408d586de9a |
children | 3841:f5afa0dc3aff |
files | plugins/mod_console.lua |
diffstat | 1 files changed, 3 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_console.lua Thu Dec 09 21:40:54 2010 +0500 +++ b/plugins/mod_console.lua Thu Dec 09 22:17:28 2010 +0500 @@ -604,31 +604,12 @@ 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()