Diff

core/s2smanager.lua @ 4822:5ef05f32bc42

mod_s2s, s2smanager, mod_dialback: Move addition of session.send() on s2sin to after they are authenticated (thus from mod_s2s to s2smanager). Update mod_dialback to fire route/remote directly, as session.send() is no longer available for s2sin_unauthed. Fixes #291.
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 May 2012 22:59:01 +0100
parent 4684:dc70c4ffb66d
child 4833:b7a6e86ab87d
line wrap: on
line diff
--- a/core/s2smanager.lua	Fri May 04 02:28:10 2012 +0100
+++ b/core/s2smanager.lua	Thu May 10 22:59:01 2012 +0100
@@ -117,10 +117,15 @@
 	local event_data = { session = session };
 	if session.type == "s2sout" then
 		prosody.events.fire_event("s2sout-established", event_data);
-		hosts[session.from_host].events.fire_event("s2sout-established", event_data);
+		hosts[from].events.fire_event("s2sout-established", event_data);
 	else
+		local host_session = hosts[to];
+		session.send = function(stanza)
+			host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza });
+		end;
+
 		prosody.events.fire_event("s2sin-established", event_data);
-		hosts[session.to_host].events.fire_event("s2sin-established", event_data);
+		hosts[to].events.fire_event("s2sin-established", event_data);
 	end
 	
 	if session.direction == "outgoing" then