Changeset

3476:193bb0936a4e

s2smanager: Fire s2s{in,out}-established when new s2s connections are ready
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Aug 2010 04:37:53 +0100
parents 3475:0307a3ac3885
children 3477:6350b114e0e4
files core/s2smanager.lua
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/s2smanager.lua	Sun Aug 29 15:07:00 2010 +0100
+++ b/core/s2smanager.lua	Mon Aug 30 04:37:53 2010 +0100
@@ -47,8 +47,9 @@
 
 dns.settimeout(dns_timeout);
 
+local prosody = _G.prosody;
 incoming_s2s = {};
-_G.prosody.incoming_s2s = incoming_s2s;
+prosody.incoming_s2s = incoming_s2s;
 local incoming_s2s = incoming_s2s;
 
 module "s2smanager"
@@ -516,6 +517,14 @@
 	local send_to_host = send_to_host;
 	function session.send(data) send_to_host(to, from, data); end
 	
+	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);
+	else
+		prosody.events.fire_event("s2sin-established", event_data);
+		hosts[session.to_host].events.fire_event("s2sin-established", event_data);
+	end
 	
 	if session.direction == "outgoing" then
 		if sendq then