aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-29 02:08:12 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-29 02:08:12 +0100
commite241b85a56b96bbda1719448a08e68cf5b8eed56 (patch)
tree5564cfe35e899b0932ba57718ae84eccf417c7c8 /plugins
parent3ba4121e11d4696a40e59486db4f005bf2c7eccd (diff)
downloadprosody-e241b85a56b96bbda1719448a08e68cf5b8eed56.tar.gz
prosody-e241b85a56b96bbda1719448a08e68cf5b8eed56.zip
mod_*: Fix many unnecessary global accesses in modules (already committed to main repo)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_component.lua11
-rw-r--r--plugins/mod_console.lua1
-rw-r--r--plugins/mod_dialback.lua2
-rw-r--r--plugins/mod_legacyauth.lua3
-rw-r--r--plugins/mod_muc.lua2
-rw-r--r--plugins/mod_register.lua4
-rw-r--r--plugins/mod_saslauth.lua6
-rw-r--r--plugins/mod_vcard.lua6
8 files changed, 25 insertions, 10 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index bbd49c5e..e5ea47a2 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -10,14 +10,19 @@ if module:get_host_type() ~= "component" then
error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0);
end
+local hosts = _G.hosts;
+
local t_concat = table.concat;
+local lxp = require "lxp";
+local logger = require "util.logger";
+local config = require "core.configmanager";
local connlisteners = require "net.connlisteners";
local cm_register_component = require "core.componentmanager".register_component;
local cm_deregister_component = require "core.componentmanager".deregister_component;
local uuid_gen = require "util.uuid".generate;
local sha1 = require "util.hashes".sha1;
-local st = stanza;
+local st = require "util.stanza";
local init_xmlhandlers = require "core.xmlhandlers";
local sessions = {};
@@ -211,8 +216,8 @@ connlisteners.register('component', component_listener);
module:add_event_hook("server-started",
function ()
- if net_activate_ports then
- net_activate_ports("component", "component", {5437}, "tcp");
+ if _G.net_activate_ports then
+ _G.net_activate_ports("component", "component", {5437}, "tcp");
else
error("No net_activate_ports: Using an incompatible version of Prosody?");
end
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index bd0095d7..502e0d06 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -8,6 +8,7 @@
module.host = "*";
+local hosts = _G.hosts;
local connlisteners_register = require "net.connlisteners".register;
local console_listener = { default_port = 5582; default_mode = "*l"; };
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index 042e2087..fe65d394 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -7,7 +7,7 @@
--
-
+local hosts = _G.hosts;
local send_s2s = require "core.s2smanager".send_to_host;
local s2s_make_authenticated = require "core.s2smanager".make_authenticated;
local s2s_verify_dialback = require "core.s2smanager".verify_dialback;
diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua
index 648aa01a..fa14f5e7 100644
--- a/plugins/mod_legacyauth.lua
+++ b/plugins/mod_legacyauth.lua
@@ -11,6 +11,9 @@
local st = require "util.stanza";
local t_concat = table.concat;
+local sessionmanager = require "core.sessionmanager";
+local usermanager = require "core.usermanager";
+
module:add_feature("jabber:iq:auth");
module:add_event_hook("stream-features", function (session, features)
if not session.username then features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); end
diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua
index 2f63ed0c..ffa0bb85 100644
--- a/plugins/mod_muc.lua
+++ b/plugins/mod_muc.lua
@@ -6,6 +6,8 @@
-- COPYING file in the source package for more information.
--
+local datamanager = require "util.datamanager";
+local datetime = require "util.datetime";
local register_component = require "core.componentmanager".register_component;
local deregister_component = require "core.componentmanager".deregister_component;
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index c04eca0a..14c00767 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -7,8 +7,10 @@
--
-
+local hosts = _G.hosts;
local st = require "util.stanza";
+local config = require "core.configmanager";
+local datamanager = require "util.datamanager";
local usermanager_user_exists = require "core.usermanager".user_exists;
local usermanager_create_user = require "core.usermanager".create_user;
local datamanager_store = require "util.datamanager".store;
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 31d62325..f7b30aab 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -10,8 +10,10 @@
local st = require "util.stanza";
local sm_bind_resource = require "core.sessionmanager".bind_resource;
+local sm_make_authenticated = require "core.sessionmanager".make_authenticated;
local base64 = require "util.encodings".base64;
+local datamanager_load = require "util.datamanager".load;
local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
local t_concat, t_insert = table.concat, table.insert;
local tostring = tostring;
@@ -49,14 +51,14 @@ local function handle_status(session, status)
session.sasl_handler = nil;
elseif status == "success" then
if not session.sasl_handler.username then error("SASL succeeded but we didn't get a username!"); end -- TODO move this to sessionmanager
- sessionmanager.make_authenticated(session, session.sasl_handler.username);
+ sm_make_authenticated(session, session.sasl_handler.username);
session.sasl_handler = nil;
session:reset_stream();
end
end
local function password_callback(node, host, mechanism, decoder)
- local password = (datamanager.load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
+ local password = (datamanager_load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
local func = function(x) return x; end;
if password then
if mechanism == "PLAIN" then
diff --git a/plugins/mod_vcard.lua b/plugins/mod_vcard.lua
index c4afb128..2e8aea02 100644
--- a/plugins/mod_vcard.lua
+++ b/plugins/mod_vcard.lua
@@ -8,13 +8,13 @@
-require "util.datamanager"
-local datamanager = datamanager;
+local hosts = _G.hosts;
+local datamanager = require "util.datamanager"
local st = require "util.stanza"
local t_concat, t_insert = table.concat, table.insert;
-require "util.jid"
+local jid = require "util.jid"
local jid_split = jid.split;
module:add_feature("vcard-temp");