Changeset

673:c9bc58e84e96

componentmanager: Added support for component deregistering
author Waqas Hussain <waqas20@gmail.com>
date Wed, 07 Jan 2009 20:02:49 +0500
parents 671:c7519f0c9a2c
children 674:4f506c627b49
files core/componentmanager.lua
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/componentmanager.lua	Sat Jan 03 18:46:52 2009 +0500
+++ b/core/componentmanager.lua	Wed Jan 07 20:02:49 2009 +0500
@@ -21,7 +21,8 @@
 
 
 local log = require "util.logger".init("componentmanager");
-local module_load = require "core.modulemanager".load;
+local module_load = require "core.modulemanager".load;
+local module_unload = require "core.modulemanager".unload;
 local jid_split = require "util.jid".split;
 local hosts = hosts;
 
@@ -56,5 +57,17 @@
 		log("error", "Attempt to set component for existing host: "..host);
 	end
 end
+
+function deregister_component(host, component)
+	if components[host] then
+		module_unload(host, "dialback");
+		components[host] = nil;
+		hosts[host] = nil;
+		log("debug", "component removed: "..host);
+		return true;
+	else
+		log("error", "Attempt to remove component for non-existing host: "..host);
+	end
+end
 
 return _M;