componentmanager: Restore default component when unregistering

Sat, 11 Apr 2009 22:25:32 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 11 Apr 2009 22:25:32 +0100
changeset 984
9acc1c2ceb2c
parent 983
460429a59c83
child 985
2ecd38c73b50

componentmanager: Restore default component when unregistering

core/componentmanager.lua file | annotate | diff | comparison | revisions
--- a/core/componentmanager.lua	Sat Apr 11 22:24:44 2009 +0100
+++ b/core/componentmanager.lua	Sat Apr 11 22:25:32 2009 +0100
@@ -102,13 +102,14 @@
 function deregister_component(host)
 	if components[host] then
 		modulemanager.unload(host, "dialback");
-		components[host] = nil;
-		local host_config = defined_hosts[host];
-		if ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then
+		local host_config = configmanager.getconfig()[host];
+		if host_config and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then
 			-- Set default handler
+			components[host] = default_component_handler;
 		else
 			-- Component not in config, or disabled, remove
 			hosts[host] = nil;
+			components[host] = nil;
 		end
 		-- remove from disco_items
 		if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then

mercurial