Comparison

plugins/mod_component.lua @ 1065:3806173670f2

mod_*: Fix many unnecessary global accesses in modules (already committed to main repo)
author Matthew Wild <mwild1@gmail.com>
date Wed, 29 Apr 2009 02:08:12 +0100
parent 981:71fce47dff7b
child 1108:368754c54045
comparison
equal deleted inserted replaced
1064:3e945c3938ad 1065:3806173670f2
8 8
9 if module:get_host_type() ~= "component" then 9 if module:get_host_type() ~= "component" then
10 error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0); 10 error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0);
11 end 11 end
12 12
13 local hosts = _G.hosts;
14
13 local t_concat = table.concat; 15 local t_concat = table.concat;
14 16
17 local lxp = require "lxp";
18 local logger = require "util.logger";
19 local config = require "core.configmanager";
15 local connlisteners = require "net.connlisteners"; 20 local connlisteners = require "net.connlisteners";
16 local cm_register_component = require "core.componentmanager".register_component; 21 local cm_register_component = require "core.componentmanager".register_component;
17 local cm_deregister_component = require "core.componentmanager".deregister_component; 22 local cm_deregister_component = require "core.componentmanager".deregister_component;
18 local uuid_gen = require "util.uuid".generate; 23 local uuid_gen = require "util.uuid".generate;
19 local sha1 = require "util.hashes".sha1; 24 local sha1 = require "util.hashes".sha1;
20 local st = stanza; 25 local st = require "util.stanza";
21 local init_xmlhandlers = require "core.xmlhandlers"; 26 local init_xmlhandlers = require "core.xmlhandlers";
22 27
23 local sessions = {}; 28 local sessions = {};
24 29
25 local log = module._log; 30 local log = module._log;
209 214
210 connlisteners.register('component', component_listener); 215 connlisteners.register('component', component_listener);
211 216
212 module:add_event_hook("server-started", 217 module:add_event_hook("server-started",
213 function () 218 function ()
214 if net_activate_ports then 219 if _G.net_activate_ports then
215 net_activate_ports("component", "component", {5437}, "tcp"); 220 _G.net_activate_ports("component", "component", {5437}, "tcp");
216 else 221 else
217 error("No net_activate_ports: Using an incompatible version of Prosody?"); 222 error("No net_activate_ports: Using an incompatible version of Prosody?");
218 end 223 end
219 end); 224 end);