42 if stanza.attr.type ~= "error" then |
42 if stanza.attr.type ~= "error" then |
43 core_route_stanza(nil, st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable")); |
43 core_route_stanza(nil, st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable")); |
44 end |
44 end |
45 end |
45 end |
46 |
46 |
47 |
47 local components_loaded_once; |
48 function load_enabled_components(config) |
48 function load_enabled_components(config) |
49 local defined_hosts = config or configmanager.getconfig(); |
49 local defined_hosts = config or configmanager.getconfig(); |
50 |
50 |
51 for host, host_config in pairs(defined_hosts) do |
51 for host, host_config in pairs(defined_hosts) do |
52 if host ~= "*" and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then |
52 if host ~= "*" and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then |
54 components[host] = default_component_handler; |
54 components[host] = default_component_handler; |
55 local ok, err = modulemanager.load(host, host_config.core.component_module); |
55 local ok, err = modulemanager.load(host, host_config.core.component_module); |
56 if not ok then |
56 if not ok then |
57 log("error", "Error loading %s component %s: %s", tostring(host_config.core.component_module), tostring(host), tostring(err)); |
57 log("error", "Error loading %s component %s: %s", tostring(host_config.core.component_module), tostring(host), tostring(err)); |
58 else |
58 else |
59 log("info", "Activated %s component: %s", host_config.core.component_module, host); |
59 log("debug", "Activated %s component: %s", host_config.core.component_module, host); |
60 end |
60 end |
61 end |
61 end |
62 end |
62 end |
63 end |
63 end |
64 |
64 |