Software /
code /
prosody-modules
Changeset
213:89051a926f74
initial creation of module for reloading new components
user: Gaurav <gauravsri@gmail.com>
branch 'default'
added mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua
author | Gaurav <gauravsri@gmail.com> |
---|---|
date | Fri, 16 Jul 2010 01:19:49 -0700 |
parents | 212:16b76c7b6316 |
children | 214:7487f8b47662 |
files | mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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); +