Diff

core/s2smanager.lua @ 3488:4f3fc5f9d944

s2smanager: Fire s2s{in,out}-destroyed when s2s connections are destroyed
author Matthew Wild <mwild1@gmail.com>
date Sun, 05 Sep 2010 12:13:49 +0100
parent 3476:193bb0936a4e
child 3489:1b76d18e8045
line wrap: on
line diff
--- a/core/s2smanager.lua	Thu Sep 02 23:09:49 2010 +0200
+++ b/core/s2smanager.lua	Sun Sep 05 12:13:49 2010 +0100
@@ -576,6 +576,19 @@
 		incoming_s2s[session] = nil;
 	end
 	
+	local event_data = { session = session, reason = reason };
+	if session.type == "s2sout" then
+		prosody.events.fire_event("s2sout-destroyed", event_data);
+		if hosts[session.from_host] then
+			hosts[session.from_host].events.fire_event("s2sout-destroyed", event_data);
+		end
+	else
+		prosody.events.fire_event("s2sin-destroyed", event_data);
+		if hosts[session.to_host] then
+			hosts[session.to_host].events.fire_event("s2sin-destroyed", event_data);
+		end
+	end
+	
 	retire_session(session); -- Clean session until it is GC'd
 end