# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1278088981 -3600
# Node ID f5243ca9662f77dbc605e8f27676ab1e3b164e98
# Parent  3d7acda82eedbd0e513b3d4a7169dcb28178b194
s2smanager: Register outgoing connection with the connection listener only after initializing filters (thanks darkrain, dersd)

diff -r 3d7acda82eed -r f5243ca9662f core/s2smanager.lua
--- a/core/s2smanager.lua	Thu Jul 01 15:31:25 2010 +0200
+++ b/core/s2smanager.lua	Fri Jul 02 17:43:01 2010 +0100
@@ -342,10 +342,6 @@
 	conn = wrapclient(conn, connect_host, connect_port, cl, cl.default_mode or 1 );
 	host_session.conn = conn;
 	
-	-- Register this outgoing connection so that xmppserver_listener knows about it
-	-- otherwise it will assume it is a new incoming connection
-	cl.register_outgoing(conn, host_session);
-	
 	local filter = initialize_filters(host_session);
 	local w, log = conn.write, host_session.log;
 	host_session.sends2s = function (t)
@@ -361,6 +357,10 @@
 		end
 	end
 	
+	-- Register this outgoing connection so that xmppserver_listener knows about it
+	-- otherwise it will assume it is a new incoming connection
+	cl.register_outgoing(conn, host_session);
+	
 	host_session:open_stream(from_host, to_host);
 	
 	log("debug", "Connection attempt in progress...");