# HG changeset patch # User Matthew Wild # Date 1363962245 0 # Node ID 4e235e565693bf8001a45f89c5f8d7b34e7dfc3a # Parent e20e94d75fe3a2e5610d9f26a801cb561c3bbdb0 mod_bidi, mod_dwd, mod_s2s_idle_timeout: Update for recent 0.9 changes (612467e263af) diff -r e20e94d75fe3 -r 4e235e565693 mod_bidi/mod_bidi.lua --- a/mod_bidi/mod_bidi.lua Tue Mar 12 19:09:26 2013 +0100 +++ b/mod_bidi/mod_bidi.lua Fri Mar 22 14:24:05 2013 +0000 @@ -65,7 +65,7 @@ end bidi_session.log("info", "Bidirectional session established"); - s2smanager.make_authenticated(bidi_session, remote_host); + module:fire_event("s2s-authenticated", { session = bidi_session, host = remote_host }); return bidi_session; end diff -r e20e94d75fe3 -r 4e235e565693 mod_dwd/mod_dwd.lua --- a/mod_dwd/mod_dwd.lua Tue Mar 12 19:09:26 2013 +0100 +++ b/mod_dwd/mod_dwd.lua Fri Mar 22 14:24:05 2013 +0000 @@ -1,6 +1,5 @@ local hosts = _G.hosts; local st = require "util.stanza"; -local s2s_make_authenticated = require "core.s2smanager".make_authenticated; local nameprep = require "util.encodings".stringprep.nameprep; local cert_verify_identity = require "util.x509".verify_identity; @@ -29,7 +28,7 @@ end module:log("info", "Accepting Dialback without Dialback for %s", from); - s2s_make_authenticated(origin, from); + module:fire_event("s2s-authenticated", { session = origin, host = from }); origin.sends2s( st.stanza("db:result", { from = attr.to, to = attr.from, id = attr.id, type = "valid" })); diff -r e20e94d75fe3 -r 4e235e565693 mod_s2s_idle_timeout/mod_s2s_idle_timeout.lua --- a/mod_s2s_idle_timeout/mod_s2s_idle_timeout.lua Tue Mar 12 19:09:26 2013 +0100 +++ b/mod_s2s_idle_timeout/mod_s2s_idle_timeout.lua Fri Mar 22 14:24:05 2013 +0000 @@ -7,8 +7,8 @@ local idle_timeout = module:get_option("s2s_idle_timeout") or 300; local check_interval = math.ceil(idle_timeout * 0.75); -local _make_authenticated = s2smanager.make_authenticated; -function s2smanager.make_authenticated(session, host) + +local function install_checks(session) if not session.last_received_time then session.last_received_time = now(); if session.direction == "incoming" then @@ -26,9 +26,12 @@ end s2s_sessions[session] = true; end - return _make_authenticated(session, host); end +module:hook("s2s-authenticated", function (event) + install_checks(event.session); +end); + function check_idle_sessions(time) time = time or now(); for session in pairs(s2s_sessions) do