From 4f7af62406498ef5a7a1b3bdef18ab714895b78b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 30 Sep 2018 17:49:56 +0200 Subject: mod_s2s: Silence all warnings instead of ignoring the entire module --- .luacheckrc | 2 -- plugins/mod_s2s/mod_s2s.lua | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 97a375d8..80436d90 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -138,8 +138,6 @@ if os.getenv("PROSODY_STRICT_LINT") ~= "1" then "plugins/mod_http_files.lua"; "plugins/mod_net_multiplex.lua"; "plugins/mod_privacy.lua"; - "plugins/mod_s2s/mod_s2s.lua"; - "plugins/mod_s2s/s2sout.lib.lua"; "plugins/mod_storage_sql1.lua"; "plugins/mod_storage_sql.lua"; "plugins/mod_websocket.lua"; diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 70b8d329..5f590338 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -119,6 +119,7 @@ function route_to_existing_session(event) if host.sendq then t_insert(host.sendq, queued_item); else + -- luacheck: ignore 122 host.sendq = { queued_item }; end host.log("debug", "stanza [%s] queued ", stanza.name); @@ -175,7 +176,7 @@ function module.add_host(module) module:hook("route/remote", route_to_new_session, -10); module:hook("s2s-authenticated", make_authenticated, -1); module:hook("s2s-read-timeout", keepalive, -1); - module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) + module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza if session.type == "s2sout" then -- Stream is authenticated and we are seem to be done with feature negotiation, -- so the stream is ready for stanzas. RFC 6120 Section 4.3 @@ -497,10 +498,13 @@ local function session_close(session, reason, remote_reason) if reason.extra then stanza:add_child(reason.extra); end - log("debug", "Disconnecting %s[%s], is: %s", session.host or session.ip or "(unknown host)", session.type, stanza); + log("debug", "Disconnecting %s[%s], is: %s", + session.host or session.ip or "(unknown host)", session.type, stanza); session.sends2s(stanza); elseif reason.name then -- a stanza - log("debug", "Disconnecting %s->%s[%s], is: %s", session.from_host or "(unknown host)", session.to_host or "(unknown host)", session.type, reason); + log("debug", "Disconnecting %s->%s[%s], is: %s", + session.from_host or "(unknown host)", session.to_host or "(unknown host)", + session.type, reason); session.sends2s(reason); end end @@ -509,8 +513,11 @@ local function session_close(session, reason, remote_reason) session.sends2s(""); function session.sends2s() return false; end + -- luacheck: ignore 422/reason + -- FIXME reason should be managed in a place common to c2s, s2s, bosh, component etc local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason; - session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); + session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), + session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); -- Authenticated incoming stream may still be sending us stanzas, so wait for from remote local conn = session.conn; @@ -529,7 +536,7 @@ local function session_close(session, reason, remote_reason) end end -function session_stream_attrs(session, from, to, attr) +function session_stream_attrs(session, from, to, attr) -- luacheck: ignore 212/session if not from or (hosts[from] and hosts[from].modules.dialback) then attr["xmlns:db"] = 'jabber:server:dialback'; end @@ -597,7 +604,7 @@ local function initialize_session(session) session.close = session_close; local handlestanza = stream_callbacks.handlestanza; - function session.dispatch_stanza(session, stanza) + function session.dispatch_stanza(session, stanza) -- luacheck: ignore 432/session return handlestanza(session, stanza); end -- cgit v1.2.3