changeset 932:4e235e565693

mod_bidi, mod_dwd, mod_s2s_idle_timeout: Update for recent 0.9 changes (612467e263af)
author Matthew Wild <mwild1@gmail.com>
date Fri, 22 Mar 2013 14:24:05 +0000
parents e20e94d75fe3
children 5a975ba6a845
files mod_bidi/mod_bidi.lua mod_dwd/mod_dwd.lua mod_s2s_idle_timeout/mod_s2s_idle_timeout.lua
diffstat 3 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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
 
--- 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" }));
 
--- 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