diff options
author | Kim Alvefur <zash@zash.se> | 2013-03-23 04:17:39 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-03-23 04:17:39 +0100 |
commit | 2bde8103f5dba708e6e7a9b0773eba493bfefa7c (patch) | |
tree | fc52870bbca26966e739b1654dd7ff728fbbd9e0 | |
parent | bcd8f33f5be7555e0c7863b76e950bd9d156afe0 (diff) | |
parent | aa0eb8fdc87589433a1cd5d03f136fb6f32a7426 (diff) | |
download | prosody-2bde8103f5dba708e6e7a9b0773eba493bfefa7c.tar.gz prosody-2bde8103f5dba708e6e7a9b0773eba493bfefa7c.zip |
Merge 0.9->trunk
-rw-r--r-- | core/certmanager.lua | 4 | ||||
-rw-r--r-- | core/configmanager.lua | 2 | ||||
-rw-r--r-- | core/hostmanager.lua | 2 | ||||
-rw-r--r-- | core/loggingmanager.lua | 4 | ||||
-rw-r--r-- | core/moduleapi.lua | 7 | ||||
-rw-r--r-- | core/modulemanager.lua | 12 | ||||
-rw-r--r-- | core/sessionmanager.lua | 2 | ||||
-rw-r--r-- | core/usermanager.lua | 12 | ||||
-rw-r--r-- | plugins/mod_admin_adhoc.lua | 6 | ||||
-rw-r--r-- | plugins/mod_announce.lua | 1 | ||||
-rw-r--r-- | plugins/mod_auth_anonymous.lua | 1 | ||||
-rw-r--r-- | plugins/mod_c2s.lua | 1 | ||||
-rw-r--r-- | plugins/mod_component.lua | 2 | ||||
-rw-r--r-- | plugins/mod_groups.lua | 2 | ||||
-rw-r--r-- | plugins/mod_http.lua | 1 | ||||
-rw-r--r-- | plugins/mod_http_errors.lua | 1 | ||||
-rw-r--r-- | plugins/mod_iq.lua | 2 | ||||
-rw-r--r-- | plugins/mod_message.lua | 4 | ||||
-rw-r--r-- | plugins/mod_motd.lua | 1 | ||||
-rw-r--r-- | plugins/mod_presence.lua | 4 | ||||
-rw-r--r-- | plugins/mod_privacy.lua | 3 | ||||
-rw-r--r-- | plugins/mod_private.lua | 1 | ||||
-rw-r--r-- | plugins/mod_proxy65.lua | 2 | ||||
-rw-r--r-- | plugins/mod_register.lua | 1 | ||||
-rw-r--r-- | plugins/mod_roster.lua | 1 | ||||
-rw-r--r-- | plugins/mod_tls.lua | 5 | ||||
-rw-r--r-- | plugins/muc/mod_muc.lua | 2 | ||||
-rw-r--r-- | util/openssl.lua | 10 | ||||
-rw-r--r-- | util/prosodyctl.lua | 4 |
29 files changed, 48 insertions, 52 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua index 8607e618..b91f7110 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -27,7 +27,7 @@ end module "certmanager" -- Global SSL options if not overridden per-host -local default_ssl_config = configmanager.get("*", "core", "ssl"); +local default_ssl_config = configmanager.get("*", "ssl"); local default_capath = "/etc/ssl/certs"; local default_verify = (ssl and ssl.x509 and { "peer", "client_once", }) or "none"; local default_options = { "no_sslv2", luasec_has_noticket and "no_ticket" or nil }; @@ -100,7 +100,7 @@ function create_context(host, mode, user_ssl_config) end function reload_ssl_config() - default_ssl_config = configmanager.get("*", "core", "ssl"); + default_ssl_config = configmanager.get("*", "ssl"); end prosody.events.add_handler("config-reloaded", reload_ssl_config); diff --git a/core/configmanager.lua b/core/configmanager.lua index a0a1f817..e31dbd72 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -25,7 +25,7 @@ local config_mt = { __index = function (t, k) return rawget(t, "*"); end}; local config = setmetatable({ ["*"] = { } }, config_mt); -- When host not found, use global -local host_mt = { }; +local host_mt = { __index = function(_, k) return config["*"][k] end } function getconfig() return config; diff --git a/core/hostmanager.lua b/core/hostmanager.lua index 40401e48..06ba72a1 100644 --- a/core/hostmanager.lua +++ b/core/hostmanager.lua @@ -74,7 +74,7 @@ function activate(host, host_config) host = host; s2sout = {}; events = events_new(); - dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(); + dialback_secret = configmanager.get(host, "dialback_secret") or uuid_gen(); send = host_send; modules = {}; }; diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua index c3fc83e4..c69dede8 100644 --- a/core/loggingmanager.lua +++ b/core/loggingmanager.lua @@ -146,7 +146,7 @@ function reload_logging() logger.reset(); - local debug_mode = config.get("*", "core", "debug"); + local debug_mode = config.get("*", "debug"); default_logging = { { to = "console" , levels = { min = (debug_mode and "debug") or "info" } } }; default_file_logging = { @@ -154,7 +154,7 @@ function reload_logging() }; default_timestamp = "%b %d %H:%M:%S"; - logging_config = config.get("*", "core", "log") or default_logging; + logging_config = config.get("*", "log") or default_logging; for name, sink_maker in pairs(old_sink_types) do diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 20898fcf..f9701471 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -167,12 +167,9 @@ function api:shared(...) end function api:get_option(name, default_value) - local value = config.get(self.host, self.name, name); + local value = config.get(self.host, name); if value == nil then - value = config.get(self.host, "core", name); - if value == nil then - value = default_value; - end + value = default_value; end return value; end diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 4ba2c27e..35b9d0e5 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -44,12 +44,12 @@ local modulemap = { ["*"] = {} }; -- Load modules when a host is activated function load_modules_for_host(host) - local component = config.get(host, "core", "component_module"); + local component = config.get(host, "component_module"); - local global_modules_enabled = config.get("*", "core", "modules_enabled"); - local global_modules_disabled = config.get("*", "core", "modules_disabled"); - local host_modules_enabled = config.get(host, "core", "modules_enabled"); - local host_modules_disabled = config.get(host, "core", "modules_disabled"); + local global_modules_enabled = config.get("*", "modules_enabled"); + local global_modules_disabled = config.get("*", "modules_disabled"); + local host_modules_enabled = config.get(host, "modules_enabled"); + local host_modules_disabled = config.get(host, "modules_disabled"); if host_modules_enabled == global_modules_enabled then host_modules_enabled = nil; end if host_modules_disabled == global_modules_disabled then host_modules_disabled = nil; end @@ -218,7 +218,7 @@ local function do_reload_module(host, name) saved = ret; else log("warn", "Error saving module '%s:%s' state: %s", host, name, ret); - if not config.get(host, "core", "force_module_reload") then + if not config.get(host, "force_module_reload") then log("warn", "Aborting reload due to error, set force_module_reload to ignore this"); return nil, "save-state-failed"; else diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 05b2d64b..e721835d 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -140,7 +140,7 @@ function bind_resource(session, resource) local sessions = hosts[session.host].sessions[session.username].sessions; if sessions[resource] then -- Resource conflict - local policy = config_get(session.host, "core", "conflict_resolve"); + local policy = config_get(session.host, "conflict_resolve"); local increment; if policy == "random" then resource = uuid_generate(); diff --git a/core/usermanager.lua b/core/usermanager.lua index 417d7037..08343bee 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -42,8 +42,8 @@ function initialize_host(host) host_session.events.add_handler("item-added/auth-provider", function (event) local provider = event.item; - local auth_provider = config.get(host, "core", "authentication") or default_provider; - if config.get(host, "core", "anonymous_login") then + local auth_provider = config.get(host, "authentication") or default_provider; + if config.get(host, "anonymous_login") then log("error", "Deprecated config option 'anonymous_login'. Use authentication = 'anonymous' instead."); auth_provider = "anonymous"; end -- COMPAT 0.7 @@ -61,8 +61,8 @@ function initialize_host(host) end end); host_session.users = new_null_provider(); -- Start with the default usermanager provider - local auth_provider = config.get(host, "core", "authentication") or default_provider; - if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7 + local auth_provider = config.get(host, "authentication") or default_provider; + if config.get(host, "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7 if auth_provider ~= "null" then modulemanager.load(host, "auth_"..auth_provider); end @@ -116,8 +116,8 @@ function is_admin(jid, host) jid = jid_bare(jid); host = host or "*"; - local host_admins = config.get(host, "core", "admins"); - local global_admins = config.get("*", "core", "admins"); + local host_admins = config.get(host, "admins"); + local global_admins = config.get("*", "admins"); if host_admins and host_admins ~= global_admins then if type(host_admins) == "table" then 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_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_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); 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; 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_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_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_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_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_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); 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; 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 diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index 707ae8f5..80b56abb 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) @@ -91,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 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; diff --git a/util/openssl.lua b/util/openssl.lua index b3dc2943..0decb579 100644 --- a/util/openssl.lua +++ b/util/openssl.lua @@ -100,13 +100,13 @@ function ssl_config:from_prosody(hosts, config, certhosts) if name == certhost or name:sub(-1-#certhost) == "."..certhost then found_matching_hosts = true; self:add_dNSName(name); - --print(name .. "#component_module: " .. (config.get(name, "core", "component_module") or "nil")); - if config.get(name, "core", "component_module") == nil then + --print(name .. "#component_module: " .. (config.get(name, "component_module") or "nil")); + if config.get(name, "component_module") == nil then self:add_sRVName(name, "xmpp-client"); end - --print(name .. "#anonymous_login: " .. tostring(config.get(name, "core", "anonymous_login"))); - if not (config.get(name, "core", "anonymous_login") or - config.get(name, "core", "authentication") == "anonymous") then + --print(name .. "#anonymous_login: " .. tostring(config.get(name, "anonymous_login"))); + if not (config.get(name, "anonymous_login") or + config.get(name, "authentication") == "anonymous") then self:add_sRVName(name, "xmpp-server"); end self:add_xmppAddr(name); diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua index e38f85d4..1ab1d0bb 100644 --- a/util/prosodyctl.lua +++ b/util/prosodyctl.lua @@ -182,12 +182,12 @@ function deluser(params) end function getpid() - local pidfile = config.get("*", "core", "pidfile"); + local pidfile = config.get("*", "pidfile"); if not pidfile then return false, "no-pidfile"; end - local modules_enabled = set.new(config.get("*", "core", "modules_enabled")); + local modules_enabled = set.new(config.get("*", "modules_enabled")); if not modules_enabled:contains("posix") then return false, "no-posix"; end |