From 54deca37412de7bc7b317ac92b4aab1b568eab0d Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 12 Oct 2012 10:28:51 +0100
Subject: Workaround receiving stream features on component connections


diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp
index 51d9d15..3269f23 100644
--- a/Swiften/Component/ComponentSession.cpp
+++ b/Swiften/Component/ComponentSession.cpp
@@ -10,6 +10,7 @@
 #include <boost/smart_ptr/make_shared.hpp>
 
 #include <Swiften/Elements/ProtocolHeader.h>
+#include <Swiften/Elements/StreamFeatures.h>
 #include <Swiften/Elements/ComponentHandshake.h>
 #include <Swiften/Session/SessionStream.h>
 #include <Swiften/Component/ComponentHandshakeGenerator.h>
@@ -66,8 +67,13 @@ void ComponentSession::handleElement(boost::shared_ptr<Element> element) {
 		onInitialized();
 	}
 	else if (getState() == Authenticating) {
-		// FIXME: We should actually check the element received
-		finishSession(Error::AuthenticationFailedError);
+		if (boost::dynamic_pointer_cast<StreamFeatures>(element)) {
+			// M-Link sends stream features, so swallow that.
+		}
+		else {
+			// FIXME: We should actually check the element received
+			finishSession(Error::AuthenticationFailedError);
+		}
 	}
 	else {
 		finishSession(Error::UnexpectedElementError);
-- 
cgit v0.10.2-6-g49f6