Mercurial > prosody-modules
annotate mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua @ 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 | |
children | 7487f8b47662 |
rev | line source |
---|---|
213
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
1 local modulemanager = require "core.modulemanager"; |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
2 local config = require "core.configmanager"; |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
3 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
4 module.host = "*"; |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
5 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
6 local function reload_components() |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
7 module:log ("debug", "reload_components"); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
8 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
9 local defined_hosts = config.getconfig(); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
10 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
11 for host in pairs(defined_hosts) do |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
12 module:log ("debug", "found host %s", host); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
13 if (not hosts[host] and host ~= "*") then |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
14 module:log ("debug", "found new host %s", host); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
15 modulemanager.load(host, configmanager.get(host, "core", "component_module")); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
16 end |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
17 end; |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
18 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
19 return; |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
20 end |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
21 |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
22 module:hook("config-reloaded", reload_components); |
89051a926f74
initial creation of module for reloading new components
Gaurav <gauravsri@gmail.com>
parents:
diff
changeset
|
23 |