core: Split some very long lines [luacheck]
authorKim Alvefur <zash@zash.se>
Sat, 04 Mar 2017 17:49:48 +0100
changeset 7950 24170d74b00b
parent 7948 1f4a0e0b7167
child 7951 ed99a8e3c260
core: Split some very long lines [luacheck]
core/configmanager.lua
core/moduleapi.lua
core/modulemanager.lua
core/portmanager.lua
core/s2smanager.lua
core/sessionmanager.lua
core/stanza_router.lua
core/storagemanager.lua
--- a/core/configmanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/configmanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -158,7 +158,8 @@
 
 		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
--- a/core/moduleapi.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/moduleapi.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -115,7 +115,8 @@
 		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
 
@@ -187,7 +188,8 @@
 		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
--- a/core/modulemanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/modulemanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -39,7 +39,8 @@
 
 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 = { ["*"] = {} };
--- a/core/portmanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/portmanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -103,7 +103,8 @@
 			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 @@
 						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 @@
 			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
 
--- a/core/s2smanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/s2smanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -70,7 +70,9 @@
 
 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;
--- a/core/sessionmanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/sessionmanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -76,7 +76,10 @@
 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
--- a/core/stanza_router.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/stanza_router.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -38,7 +38,8 @@
 		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 @@
 			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 @@
 		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
--- a/core/storagemanager.lua	Fri Mar 03 11:51:32 2017 +0100
+++ b/core/storagemanager.lua	Sat Mar 04 17:49:48 2017 +0100
@@ -72,7 +72,8 @@
 		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 @@
 				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