Comparison

core/componentmanager.lua @ 1366:54b5121b6c83

componentmanager: Using prosody.events instead of core.eventmanager
author Waqas Hussain <waqas20@gmail.com>
date Sat, 20 Jun 2009 14:38:22 +0500
parent 1264:498293bce4bf
child 1434:b5d4db71ef1a
comparison
equal deleted inserted replaced
1365:864a99eff6d7 1366:54b5121b6c83
6 -- COPYING file in the source package for more information. 6 -- COPYING file in the source package for more information.
7 -- 7 --
8 8
9 9
10 10
11 11 local prosody = prosody;
12 local log = require "util.logger".init("componentmanager"); 12 local log = require "util.logger".init("componentmanager");
13 local configmanager = require "core.configmanager"; 13 local configmanager = require "core.configmanager";
14 local eventmanager = require "core.eventmanager";
15 local modulemanager = require "core.modulemanager"; 14 local modulemanager = require "core.modulemanager";
16 local core_route_stanza = core_route_stanza; 15 local core_route_stanza = core_route_stanza;
17 local jid_split = require "util.jid".split; 16 local jid_split = require "util.jid".split;
18 local events_new = require "util.events".new; 17 local events_new = require "util.events".new;
19 local st = require "util.stanza"; 18 local st = require "util.stanza";
32 end 31 end
33 return true; 32 return true;
34 end 33 end
35 end); 34 end);
36 35
37 require "core.eventmanager".add_event_hook("server-starting", function () core_route_stanza = _G.core_route_stanza; end); 36 prosody.events.add_handler("server-starting", function () core_route_stanza = _G.core_route_stanza; end);
38 37
39 module "componentmanager" 38 module "componentmanager"
40 39
41 local function default_component_handler(origin, stanza) 40 local function default_component_handler(origin, stanza)
42 log("warn", "Stanza being handled by default component, bouncing error"); 41 log("warn", "Stanza being handled by default component, bouncing error");
61 end 60 end
62 end 61 end
63 end 62 end
64 end 63 end
65 64
66 eventmanager.add_event_hook("server-starting", load_enabled_components); 65 prosody.events.add_handler("server-starting", load_enabled_components);
67 66
68 function handle_stanza(origin, stanza) 67 function handle_stanza(origin, stanza)
69 local node, host = jid_split(stanza.attr.to); 68 local node, host = jid_split(stanza.attr.to);
70 local component = nil; 69 local component = nil;
71 if host then 70 if host then