# HG changeset patch # User Gaurav # Date 1279268389 25200 # Node ID 89051a926f7425fffe49db1a1222af378ecb86e2 # Parent 16b76c7b6316cb2131b83b927e303dc958477d78 initial creation of module for reloading new components user: Gaurav branch 'default' added mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua diff -r 16b76c7b6316 -r 89051a926f74 mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua Fri Jul 16 01:19:49 2010 -0700 @@ -0,0 +1,23 @@ +local modulemanager = require "core.modulemanager"; +local config = require "core.configmanager"; + +module.host = "*"; + +local function reload_components() + module:log ("debug", "reload_components"); + + local defined_hosts = config.getconfig(); + + for host in pairs(defined_hosts) do + module:log ("debug", "found host %s", host); + if (not hosts[host] and host ~= "*") then + module:log ("debug", "found new host %s", host); + modulemanager.load(host, configmanager.get(host, "core", "component_module")); + end + end; + + return; +end + +module:hook("config-reloaded", reload_components); +