Diff

core/s2smanager.lua @ 345:6a7acfc1c933

Send version=1.0 in s2s stream header. Send s2s stream:features when in 1.0 mode.
author Matthew Wild <mwild1@gmail.com>
date Wed, 19 Nov 2008 05:13:07 +0000
parent 344:ed5824e9dd94
child 346:22c8f7d412a1
line wrap: on
line diff
--- a/core/s2smanager.lua	Wed Nov 19 05:12:21 2008 +0000
+++ b/core/s2smanager.lua	Wed Nov 19 05:13:07 2008 +0000
@@ -160,12 +160,28 @@
 		session.streamid = uuid_gen();
 		print(session, session.from_host, "incoming s2s stream opened");
 		send("<?xml version='1.0'?>");
-		send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag());
+		send(stanza("stream:stream", { version = '1.0', xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag());
 		if session.to_host and not hosts[session.to_host] then
 			-- Attempting to connect to a host we don't serve
 			session:close("host-unknown");
 			return;
 		end
+		if session.version >= 1.0 then
+			send(st.stanza("stream:features")
+					:tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up());
+		end
+		--[[
+		local features = {};
+		modulemanager.fire_event("stream-features-s2s", session, features);
+	
+		send("<stream:features>");
+	
+		for _, feature in ipairs(features) do
+			send(tostring(feature));
+		end
+
+		send("</stream:features>");
+		]]
 	elseif session.direction == "outgoing" then
 		-- If we are just using the connection for verifying dialback keys, we won't try and auth it
 		if not attr.id then error("stream response did not give us a streamid!!!"); end
@@ -177,17 +193,6 @@
 			mark_connected(session);
 		end
 	end
-	--[[
-	local features = {};
-	modulemanager.fire_event("stream-features-s2s", session, features);
-	
-	send("<stream:features>");
-	
-	for _, feature in ipairs(features) do
-		send(tostring(feature));
-	end
-
-	send("</stream:features>");]]
 
 	session.notopen = nil;
 end