# HG changeset patch # User Kim Alvefur # Date 1538322596 -7200 # Node ID 063977461363e949005ace0ee424aa31d18b2645 # Parent 62c876e333e4838a81305dd8c434e3fa1944c116 mod_s2s: Silence all warnings instead of ignoring the entire module diff -r 62c876e333e4 -r 063977461363 .luacheckrc --- a/.luacheckrc Sun Sep 30 14:55:39 2018 +0200 +++ b/.luacheckrc Sun Sep 30 17:49:56 2018 +0200 @@ -138,8 +138,6 @@ "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 -r 62c876e333e4 -r 063977461363 plugins/mod_s2s/mod_s2s.lua --- a/plugins/mod_s2s/mod_s2s.lua Sun Sep 30 14:55:39 2018 +0200 +++ b/plugins/mod_s2s/mod_s2s.lua Sun Sep 30 17:49:56 2018 +0200 @@ -119,6 +119,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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