100 end |
100 end |
101 |
101 |
102 function deregister_component(host) |
102 function deregister_component(host) |
103 if components[host] then |
103 if components[host] then |
104 modulemanager.unload(host, "dialback"); |
104 modulemanager.unload(host, "dialback"); |
105 components[host] = nil; |
105 local host_config = configmanager.getconfig()[host]; |
106 local host_config = defined_hosts[host]; |
106 if host_config and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then |
107 if ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then |
|
108 -- Set default handler |
107 -- Set default handler |
|
108 components[host] = default_component_handler; |
109 else |
109 else |
110 -- Component not in config, or disabled, remove |
110 -- Component not in config, or disabled, remove |
111 hosts[host] = nil; |
111 hosts[host] = nil; |
|
112 components[host] = nil; |
112 end |
113 end |
113 -- remove from disco_items |
114 -- remove from disco_items |
114 if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then |
115 if not(host:find("@", 1, true) or host:find("/", 1, true)) and host:find(".", 1, true) then |
115 disco_items:remove(host:sub(host:find(".", 1, true)+1), host); |
116 disco_items:remove(host:sub(host:find(".", 1, true)+1), host); |
116 end |
117 end |