Software /
code /
prosody
Comparison
core/componentmanager.lua @ 1712:45a81d6d8777
Merge waqas with Tobias. Eww.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 18 Aug 2009 13:03:35 +0100 |
parent | 1705:99c9f59ed365 |
child | 1772:c0ba9cd6ee63 |
comparison
equal
deleted
inserted
replaced
1686:232c2bf155c7 | 1712:45a81d6d8777 |
---|---|
3 -- Copyright (C) 2008-2009 Waqas Hussain | 3 -- Copyright (C) 2008-2009 Waqas Hussain |
4 -- | 4 -- |
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | |
9 | |
10 | 8 |
11 local prosody = prosody; | 9 local prosody = prosody; |
12 local log = require "util.logger".init("componentmanager"); | 10 local log = require "util.logger".init("componentmanager"); |
13 local configmanager = require "core.configmanager"; | 11 local configmanager = require "core.configmanager"; |
14 local modulemanager = require "core.modulemanager"; | 12 local modulemanager = require "core.modulemanager"; |
23 | 21 |
24 local components = {}; | 22 local components = {}; |
25 | 23 |
26 local disco_items = require "util.multitable".new(); | 24 local disco_items = require "util.multitable".new(); |
27 local NULL = {}; | 25 local NULL = {}; |
28 require "core.discomanager".addDiscoItemsHandler("*host", function(reply, to, from, node) | |
29 if #node == 0 and hosts[to] then | |
30 for jid in pairs(disco_items:get(to) or NULL) do | |
31 reply:tag("item", {jid = jid}):up(); | |
32 end | |
33 return true; | |
34 end | |
35 end); | |
36 | 26 |
37 prosody.events.add_handler("server-starting", function () core_route_stanza = _G.core_route_stanza; end); | 27 prosody.events.add_handler("server-starting", function () core_route_stanza = _G.core_route_stanza; end); |
38 | 28 |
39 module "componentmanager" | 29 module "componentmanager" |
40 | 30 |
136 | 126 |
137 function set_component_handler(host, handler) | 127 function set_component_handler(host, handler) |
138 components[host] = handler; | 128 components[host] = handler; |
139 end | 129 end |
140 | 130 |
131 function get_children(host) | |
132 return disco_items:get(host) or NULL; | |
133 end | |
134 | |
141 return _M; | 135 return _M; |