From 27dc3a5b9ab179a226599996d1e148b394275e67 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:27:16 +0100 Subject: mod_announce, mod_auth_anonymous, mod_c2s, mod_c2s, mod_component, mod_iq, mod_message, mod_presence, mod_tls: Access prosody.{hosts,bare_sessions,full_sessions} instead of the old globals --- plugins/mod_announce.lua | 1 + plugins/mod_auth_anonymous.lua | 1 + plugins/mod_c2s.lua | 1 + plugins/mod_component.lua | 2 +- plugins/mod_iq.lua | 2 +- plugins/mod_message.lua | 4 ++-- plugins/mod_presence.lua | 4 +++- plugins/mod_privacy.lua | 3 +-- plugins/mod_tls.lua | 1 + 9 files changed, 12 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_announce.lua b/plugins/mod_announce.lua index 0872bd21..96976d6f 100644 --- a/plugins/mod_announce.lua +++ b/plugins/mod_announce.lua @@ -8,6 +8,7 @@ local st, jid = require "util.stanza", require "util.jid"; +local hosts = prosody.hosts; local is_admin = require "core.usermanager".is_admin; function send_to_online(message, host) diff --git a/plugins/mod_auth_anonymous.lua b/plugins/mod_auth_anonymous.lua index a327f438..c877d532 100644 --- a/plugins/mod_auth_anonymous.lua +++ b/plugins/mod_auth_anonymous.lua @@ -8,6 +8,7 @@ local new_sasl = require "util.sasl".new; local datamanager = require "util.datamanager"; +local hosts = prosody.hosts; -- define auth provider local provider = {}; diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 89d678ca..4a3197d9 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -29,6 +29,7 @@ local opt_keepalives = module:get_option_boolean("tcp_keepalives", false); local sessions = module:shared("sessions"); local core_process_stanza = prosody.core_process_stanza; +local hosts = prosody.hosts; local stream_callbacks = { default_ns = "jabber:client", handlestanza = core_process_stanza }; local listener = {}; diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 68d8a5de..871a20e4 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -19,7 +19,7 @@ local new_xmpp_stream = require "util.xmppstream".new; local uuid_gen = require "util.uuid".generate; local core_process_stanza = prosody.core_process_stanza; - +local hosts = prosody.hosts; local log = module._log; diff --git a/plugins/mod_iq.lua b/plugins/mod_iq.lua index 8044a533..e7901ab4 100644 --- a/plugins/mod_iq.lua +++ b/plugins/mod_iq.lua @@ -9,7 +9,7 @@ local st = require "util.stanza"; -local full_sessions = full_sessions; +local full_sessions = prosody.full_sessions; if module:get_host_type() == "local" then module:hook("iq/full", function(data) diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index 0b0ad8e4..e85da613 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -7,8 +7,8 @@ -- -local full_sessions = full_sessions; -local bare_sessions = bare_sessions; +local full_sessions = prosody.full_sessions; +local bare_sessions = prosody.bare_sessions; local st = require "util.stanza"; local jid_bare = require "util.jid".bare; diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 23012750..b6e3fc18 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -19,7 +19,9 @@ local st = require "util.stanza"; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; local datetime = require "util.datetime"; -local hosts = hosts; +local hosts = prosody.hosts; +local bare_sessions = prosody.bare_sessions; +local full_sessions = prosody.full_sessions; local NULL = {}; local rostermanager = require "core.rostermanager"; diff --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua index 2d696154..7ec94922 100644 --- a/plugins/mod_privacy.lua +++ b/plugins/mod_privacy.lua @@ -9,10 +9,9 @@ module:add_feature("jabber:iq:privacy"); -local prosody = prosody; local st = require "util.stanza"; local datamanager = require "util.datamanager"; -local bare_sessions, full_sessions = bare_sessions, full_sessions; +local bare_sessions, full_sessions = prosody.bare_sessions, prosody.full_sessions; local util_Jid = require "util.jid"; local jid_bare = util_Jid.bare; local jid_split, jid_join = util_Jid.split, util_Jid.join; diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index 707ae8f5..2fcf5f03 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -25,6 +25,7 @@ if secure_s2s_only then s2s_feature:tag("required"):up(); end local global_ssl_ctx = prosody.global_ssl_ctx; +local hosts = prosody.hosts; local host = hosts[module.host]; local function can_do_tls(session) -- cgit v1.2.3 From 91cc88b33807e5ed5978ebb8a89928f47f1618f5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:27:38 +0100 Subject: mod_motd, mod_register, mod_private, mod_http_errors, mod_admin_adhoc: Remove unused imports --- plugins/mod_admin_adhoc.lua | 6 ++---- plugins/mod_http_errors.lua | 1 - plugins/mod_motd.lua | 1 - plugins/mod_private.lua | 1 - plugins/mod_register.lua | 1 - 5 files changed, 2 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index f136eb46..ff672fc9 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -10,8 +10,7 @@ local prosody = _G.prosody; local hosts = prosody.hosts; local t_concat = table.concat; -local iterators = require "util.iterators"; -local keys, values = iterators.keys, iterators.values; +local keys = require "util.iterators".keys; local usermanager_user_exists = require "core.usermanager".user_exists; local usermanager_create_user = require "core.usermanager".create_user; local usermanager_delete_user = require "core.usermanager".delete_user; @@ -19,9 +18,8 @@ local usermanager_get_password = require "core.usermanager".get_password; local usermanager_set_password = require "core.usermanager".set_password; local hostmanager_activate = require "core.hostmanager".activate; local hostmanager_deactivate = require "core.hostmanager".deactivate; -local is_admin = require "core.usermanager".is_admin; local rm_load_roster = require "core.rostermanager".load_roster; -local st, jid, uuid = require "util.stanza", require "util.jid", require "util.uuid"; +local st, jid = require "util.stanza", require "util.jid"; local timer_add_task = require "util.timer".add_task; local dataforms_new = require "util.dataforms".new; local array = require "util.array"; diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 828216dd..2568ea80 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -2,7 +2,6 @@ module:set_global(); local server = require "net.http.server"; local codes = require "net.http.codes"; -local termcolours = require "util.termcolours"; local show_private = module:get_option_boolean("http_errors_detailed", false); local always_serve = module:get_option_boolean("http_errors_always_show", true); diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua index fea2cb85..ed78294b 100644 --- a/plugins/mod_motd.lua +++ b/plugins/mod_motd.lua @@ -13,7 +13,6 @@ local motd_jid = module:get_option_string("motd_jid", host); if not motd_text then return; end -local jid_join = require "util.jid".join; local st = require "util.stanza"; motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config diff --git a/plugins/mod_private.lua b/plugins/mod_private.lua index f1ebe786..29d3162c 100644 --- a/plugins/mod_private.lua +++ b/plugins/mod_private.lua @@ -9,7 +9,6 @@ local st = require "util.stanza" -local jid_split = require "util.jid".split; local datamanager = require "util.datamanager" module:add_feature("jabber:iq:private"); diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index b3abd394..e941a128 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -7,7 +7,6 @@ -- -local hosts = _G.hosts; local st = require "util.stanza"; local datamanager = require "util.datamanager"; local dataform_new = require "util.dataforms".new; -- cgit v1.2.3 From 1faf33dfd581e6c75b6d2bf220caf65bcb98b2ba Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:35:52 +0100 Subject: mod_roster: Remove unused variable --- plugins/mod_roster.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua index 40d95be7..d530bb45 100644 --- a/plugins/mod_roster.lua +++ b/plugins/mod_roster.lua @@ -69,7 +69,6 @@ module:hook("iq/self/jabber:iq:roster:query", function(event) and query.tags[1].attr.jid ~= "pending" then local item = query.tags[1]; local from_node, from_host = jid_split(stanza.attr.from); - local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID local jid = jid_prep(item.attr.jid); local node, host, resource = jid_split(jid); if not resource and host then -- cgit v1.2.3 From 9d07cc98e441992af3b1339358635a1ce507b4c5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:39:56 +0100 Subject: mod_groups: Use module API for reading config --- plugins/mod_groups.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_groups.lua b/plugins/mod_groups.lua index 7a876f1d..199925f9 100644 --- a/plugins/mod_groups.lua +++ b/plugins/mod_groups.lua @@ -80,7 +80,7 @@ function remove_virtual_contacts(username, host, datastore, data) end function module.load() - groups_file = config.get(module:get_host(), "core", "groups_file"); + groups_file = module:get_option_string("groups_file"); if not groups_file then return; end module:hook("roster-load", inject_roster_contacts); -- cgit v1.2.3 From 4a30cfbc9062def1b3def980d6995f10d9fc7e41 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:42:27 +0100 Subject: mod_http: Import portmanager --- plugins/mod_http.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index c5381577..2fa87421 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -9,6 +9,7 @@ module:set_global(); module:depends("http_errors"); +local portmanager = require "core.portmanager"; local moduleapi = require "core.moduleapi"; local url_parse = require "socket.url".parse; local url_build = require "socket.url".build; -- cgit v1.2.3 From aaf84ae073c034153b1f3018d4ebf7aaa3a21813 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 01:42:48 +0100 Subject: mod_proxy65: Fix typo in comment --- plugins/mod_proxy65.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index 0d05b2ac..1fa42bd8 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -95,7 +95,7 @@ function module.add_host(module) local proxy_port = next(portmanager.get_active_services():search("proxy65", nil)[1] or {}); local proxy_acl = module:get_option("proxy65_acl"); - -- COMPAT w/pre-0.9 where proxy65_port was specified the components section of the config + -- COMPAT w/pre-0.9 where proxy65_port was specified in the components section of the config local legacy_config = module:get_option_number("proxy65_port"); if legacy_config then module:log("warn", "proxy65_port is deprecated, please put proxy65_ports = { %d } into the global section instead", legacy_config); -- cgit v1.2.3 From 974917a5a22e27441c086474be2672b3ba1fa3af Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 02:24:11 +0100 Subject: MUC: Access prosody.hosts instead of the old global hosts --- plugins/muc/mod_muc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 9f907f17..2c2d02f7 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -30,7 +30,7 @@ local st = require "util.stanza"; local uuid_gen = require "util.uuid".generate; local datamanager = require "util.datamanager"; local um_is_admin = require "core.usermanager".is_admin; -local hosts = hosts; +local hosts = prosody.hosts; rooms = {}; local rooms = rooms; -- cgit v1.2.3 From 16c7c4e78d92b0c86466fe2e4851617665463193 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 02:35:50 +0100 Subject: mod_tls: More use of config sections removed --- plugins/mod_tls.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index 2fcf5f03..80b56abb 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -92,10 +92,10 @@ module:hook_stanza(xmlns_starttls, "proceed", function (session, stanza) end); function module.load() - local ssl_config = config.rawget(module.host, "core", "ssl"); + local ssl_config = config.rawget(module.host, "ssl"); if not ssl_config then local base_host = module.host:match("%.(.*)"); - ssl_config = config.get(base_host, "core", "ssl"); + ssl_config = config.get(base_host, "ssl"); end host.ssl_ctx = create_context(host.host, "client", ssl_config); -- for outgoing connections host.ssl_ctx_in = create_context(host.host, "server", ssl_config); -- for incoming connections -- cgit v1.2.3