aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-03-06 01:14:32 +0100
committerKim Alvefur <zash@zash.se>2017-03-06 01:14:32 +0100
commitca65f0d2d3718301b880c0260c991cd8ee7977ae (patch)
treee58db2bf464bf09301a9c02c27330c2dba6b926d
parentb133b78d47ff180110b0b29612d3cd257a9972c1 (diff)
parente45c5961ac42007aa6c9282afddff91cd1e27124 (diff)
downloadprosody-ca65f0d2d3718301b880c0260c991cd8ee7977ae.tar.gz
prosody-ca65f0d2d3718301b880c0260c991cd8ee7977ae.zip
Merge 0.10->trunk
-rw-r--r--.luacheckrc5
-rw-r--r--core/configmanager.lua3
-rw-r--r--core/loggingmanager.lua2
-rw-r--r--core/moduleapi.lua6
-rw-r--r--core/modulemanager.lua3
-rw-r--r--core/portmanager.lua12
-rw-r--r--core/rostermanager.lua2
-rw-r--r--core/s2smanager.lua4
-rw-r--r--core/sessionmanager.lua6
-rw-r--r--core/stanza_router.lua12
-rw-r--r--core/storagemanager.lua6
11 files changed, 42 insertions, 19 deletions
diff --git a/.luacheckrc b/.luacheckrc
index 80c903c3..0040cfbb 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -7,8 +7,11 @@ unused_secondaries = false
codes = true
ignore = { "411/err", "421/err", "411/ok", "421/ok", "211/_ENV" }
+max_line_length = 150
+
files["core/"] = {
- ignore = { "122/prosody", "122/hosts" };
+ read_globals = { "prosody", "hosts" };
+ globals = { "prosody.hosts.?", "hosts.?" };
}
files["plugins/"] = {
globals = { "module" };
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 16d4b8e2..5a544375 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -158,7 +158,8 @@ do
function env.Component(name)
name = nameprep(name);
- if rawget(config_table, name) and rawget(config_table[name], "defined") and not rawget(config_table[name], "component_module") then
+ if rawget(config_table, name) and rawget(config_table[name], "defined")
+ and not rawget(config_table[name], "component_module") then
error(format("Component %q clashes with previously defined Host %q, for services use a sub-domain like conference.%s",
name, name, name), 0);
end
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index e3a83817..14305588 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -5,7 +5,7 @@
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
-
+-- luacheck: globals log prosody.log
local format = string.format;
local setmetatable, rawset, pairs, ipairs, type =
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index d89d46fa..62c34031 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -116,7 +116,8 @@ function api:hook_tag(xmlns, name, handler, priority)
self:log("warn", "Error: Insufficient parameters to module:hook_stanza()");
return;
end
- return self:hook("stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority);
+ return self:hook("stanza/"..(xmlns and (xmlns..":") or "")..name,
+ function (data) return handler(data.origin, data.stanza, data); end, priority);
end
api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9
@@ -188,7 +189,8 @@ function api:shared(...)
local path = paths[i];
if path:sub(1,1) ~= "/" then -- Prepend default components
local n_components = select(2, path:gsub("/", "%1"));
- path = (n_components<#default_path_components and "/" or "")..t_concat(default_path_components, "/", 1, #default_path_components-n_components).."/"..path;
+ path = (n_components<#default_path_components and "/" or "")
+ ..t_concat(default_path_components, "/", 1, #default_path_components-n_components).."/"..path;
end
local shared = shared_data[path];
if not shared then
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 7bed1795..771f6fb1 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -39,7 +39,8 @@ local _G = _G;
local _ENV = nil;
-local load_modules_for_host, load, unload, reload, get_module, get_items, get_modules, is_loaded, module_has_method, call_module_method;
+local load_modules_for_host, load, unload, reload, get_module, get_items;
+local get_modules, is_loaded, module_has_method, call_module_method;
-- [host] = { [module] = module_env }
local modulemap = { ["*"] = {} };
diff --git a/core/portmanager.lua b/core/portmanager.lua
index ad1a0be3..5b6476f3 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -103,7 +103,8 @@ local function activate(service_name)
if not port_number then
log("error", "Invalid port number specified for service '%s': %s", service_info.name, tostring(port));
elseif #active_services:search(nil, interface, port_number) > 0 then
- log("error", "Multiple services configured to listen on the same port ([%s]:%d): %s, %s", interface, port, active_services:search(nil, interface, port)[1][1].service.name or "<unnamed>", service_name or "<unnamed>");
+ log("error", "Multiple services configured to listen on the same port ([%s]:%d): %s, %s", interface, port,
+ active_services:search(nil, interface, port)[1][1].service.name or "<unnamed>", service_name or "<unnamed>");
else
local err;
-- Create SSL context for this service/port
@@ -118,14 +119,16 @@ local function activate(service_name)
global_ssl_config[interface],
global_ssl_config[port]);
if not ssl then
- log("error", "Error binding encrypted port for %s: %s", service_info.name, error_to_friendly_message(service_name, port_number, err) or "unknown error");
+ log("error", "Error binding encrypted port for %s: %s", service_info.name,
+ error_to_friendly_message(service_name, port_number, err) or "unknown error");
end
end
if not err then
-- Start listening on interface+port
local handler, err = server.addserver(interface, port_number, listener, mode, ssl);
if not handler then
- log("error", "Failed to open server port %d on %s, %s", port_number, interface, error_to_friendly_message(service_name, port_number, err));
+ log("error", "Failed to open server port %d on %s, %s", port_number, interface,
+ error_to_friendly_message(service_name, port_number, err));
else
table.insert(hooked_ports, "["..interface.."]:"..port_number);
log("debug", "Added listening service %s to [%s]:%d", service_name, interface, port_number);
@@ -138,7 +141,8 @@ local function activate(service_name)
end
end
end
- log("info", "Activated service '%s' on %s", service_name, #hooked_ports == 0 and "no ports" or table.concat(hooked_ports, ", "));
+ log("info", "Activated service '%s' on %s", service_name,
+ #hooked_ports == 0 and "no ports" or table.concat(hooked_ports, ", "));
return true;
end
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index 88bd1e66..dc60ccdf 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -5,7 +5,7 @@
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
-
+-- luacheck: globals prosody.bare_sessions.?.roster
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index abeaa646..1e8b1120 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -71,7 +71,9 @@ end
local function destroy_session(session, reason)
if session.destroyed then return; end
- (session.log or log)("debug", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)..(reason and (": "..reason) or ""));
+ (session.log or log)("debug", "Destroying "..tostring(session.direction)
+ .." session "..tostring(session.from_host).."->"..tostring(session.to_host)
+ ..(reason and (": "..reason) or ""));
if session.direction == "outgoing" then
hosts[session.from_host].s2sout[session.to_host] = nil;
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 3224a84d..9ec05539 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -5,6 +5,7 @@
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
+-- luacheck: globals prosody.full_sessions prosody.bare_sessions
local tostring, setmetatable = tostring, setmetatable;
local pairs, next= pairs, next;
@@ -77,7 +78,10 @@ local function retire_session(session)
end
local function destroy_session(session, err)
- (session.log or log)("debug", "Destroying session for %s (%s@%s)%s", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)", err and (": "..err) or "");
+ (session.log or log)("debug", "Destroying session for %s (%s@%s)%s",
+ session.full_jid or "(unknown)", session.username or "(unknown)",
+ session.host or "(unknown)", err and (": "..err) or "");
+
if session.destroyed then return; end
-- Remove session/resource from user's session list
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 228fed80..2312614c 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -38,7 +38,8 @@ local function handle_unhandled_stanza(host, origin, stanza) --luacheck: ignore
if st_type == "error" or (name == "iq" and st_type == "result") then
if st_type == "error" then
local err_type, err_condition, err_message = stanza:get_error();
- log("debug", "Discarding unhandled error %s (%s, %s) from %s: %s", name, err_type, err_condition or "unknown condition", origin_type, stanza:top_tag());
+ log("debug", "Discarding unhandled error %s (%s, %s) from %s: %s",
+ name, err_type, err_condition or "unknown condition", origin_type, stanza:top_tag());
else
log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>');
end
@@ -52,7 +53,8 @@ local function handle_unhandled_stanza(host, origin, stanza) --luacheck: ignore
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
end
else
- log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s", origin_type, name, xmlns, tostring(stanza)); -- we didn't handle it
+ log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s",
+ origin_type, name, xmlns, tostring(stanza)); -- we didn't handle it
origin:close("unsupported-stanza-type");
end
end
@@ -211,12 +213,14 @@ function core_route_stanza(origin, stanza)
else
local xmlns = stanza.attr.xmlns;
stanza.attr.xmlns = nil;
- local routed = host_session.events.fire_event("route/remote", { origin = origin, stanza = stanza, from_host = from_host, to_host = host });
+ local routed = host_session.events.fire_event("route/remote", {
+ origin = origin, stanza = stanza, from_host = from_host, to_host = host });
stanza.attr.xmlns = xmlns; -- reset
if not routed then
log("debug", "... no, just kidding.");
if stanza.attr.type == "error" or (stanza.name == "iq" and stanza.attr.type == "result") then return; end
- core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled"));
+ core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed",
+ "Communication with remote domains is not enabled"));
end
end
end
diff --git a/core/storagemanager.lua b/core/storagemanager.lua
index f0450dfb..f1b70615 100644
--- a/core/storagemanager.lua
+++ b/core/storagemanager.lua
@@ -72,7 +72,8 @@ local function get_storage_config(host)
end
end
if found_sql2 then
- log("error", "The temporary 'sql2' storage module has now been renamed to 'sql', please update your config file: https://prosody.im/doc/modules/mod_storage_sql2");
+ log("error", "The temporary 'sql2' storage module has now been renamed to 'sql', "
+ .."please update your config file: https://prosody.im/doc/modules/mod_storage_sql2");
end
return storage_config;
end
@@ -180,7 +181,8 @@ local function purge(user, host)
if driver.purge then
purged[driver_name] = driver:purge(user);
else
- log("warn", "Storage driver %s does not support removing all user data, you may need to delete it manually", driver_name);
+ log("warn", "Storage driver %s does not support removing all user data, "
+ .."you may need to delete it manually", driver_name);
end
end
end