Automated merge with http://waqas.ath.cx:8000/
[prosody.git] / plugins / mod_console.lua
index 8b123df4d86f7a3485f1f1a1543cb4bc2dae6863..d6383a780f19eca232e2e8310034d3df68fc942d 100644 (file)
@@ -1,3 +1,23 @@
+-- Prosody IM v0.2
+-- Copyright (C) 2008 Matthew Wild
+-- Copyright (C) 2008 Waqas Hussain
+-- 
+-- This program is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU General Public License
+-- as published by the Free Software Foundation; either version 2
+-- of the License, or (at your option) any later version.
+-- 
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+-- 
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+--
+
+
 \r
 local connlisteners_register = require "net.connlisteners".register;\r
 \r
@@ -124,20 +144,29 @@ end
 \r
 def_env.server = {};\r
 function def_env.server:reload()\r
-       dofile "main.lua"\r
+       dofile "prosody"\r
        return true, "Server reloaded";\r
 end\r
 \r
 def_env.module = {};\r
-function def_env.module:load(name, host)\r
+function def_env.module:load(name, host, config)\r
        local mm = require "modulemanager";\r
-       local ok, err = mm.load(host or self.env.host, name);\r
+       local ok, err = mm.load(host or self.env.host, name, config);\r
        if not ok then\r
                return false, err or "Unknown error loading module";\r
        end\r
        return true, "Module loaded";\r
 end\r
 \r
+function def_env.module:unload(name, host)\r
+       local mm = require "modulemanager";\r
+       local ok, err = mm.unload(host or self.env.host, name);\r
+       if not ok then\r
+               return false, err or "Unknown error unloading module";\r
+       end\r
+       return true, "Module unloaded";\r
+end\r
+\r
 def_env.config = {};\r
 function def_env.config:load(filename, format)\r
        local config_load = require "core.configmanager".load;\r