summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-18 19:04:32 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-18 20:40:56 (GMT)
commit4457bc810a326de8d7895b3f2ff36ade5f1ae1a0 (patch)
tree1556c4b0190453897d4799d23b05e651b0bb8a32 /Swiften/Client
parent4052a822acd9da9dab6a8e2343c6170fb08dd8d6 (diff)
downloadswift-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.zip
swift-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.tar.bz2
Implement incoming linklocal connections.
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/Session.cpp5
-rw-r--r--Swiften/Client/UnitTest/SessionTest.cpp12
2 files changed, 13 insertions, 4 deletions
diff --git a/Swiften/Client/Session.cpp b/Swiften/Client/Session.cpp
index 2f0e076..6c2a873 100644
--- a/Swiften/Client/Session.cpp
+++ b/Swiften/Client/Session.cpp
@@ -3,6 +3,7 @@
#include <boost/bind.hpp>
#include "Swiften/Network/ConnectionFactory.h"
+#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/StreamStack/StreamStack.h"
#include "Swiften/StreamStack/ConnectionLayer.h"
#include "Swiften/StreamStack/XMPPLayer.h"
@@ -61,7 +62,9 @@ void Session::handleConnected() {
}
void Session::sendStreamHeader() {
- xmppLayer_->writeHeader(jid_.getDomain());
+ ProtocolHeader header;
+ header.setTo(jid_.getDomain());
+ xmppLayer_->writeHeader(header);
}
void Session::initializeStreamStack() {
diff --git a/Swiften/Client/UnitTest/SessionTest.cpp b/Swiften/Client/UnitTest/SessionTest.cpp
index 45c0996..a11ddde 100644
--- a/Swiften/Client/UnitTest/SessionTest.cpp
+++ b/Swiften/Client/UnitTest/SessionTest.cpp
@@ -11,6 +11,7 @@
#include "Swiften/StreamStack/TLSLayer.h"
#include "Swiften/StreamStack/StreamStack.h"
#include "Swiften/StreamStack/WhitespacePingLayer.h"
+#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/Elements/StreamFeatures.h"
#include "Swiften/Elements/Element.h"
#include "Swiften/Elements/Error.h"
@@ -486,6 +487,7 @@ class SessionTest : public CppUnit::TestFixture {
assert(false);
}
+ void connect(const HostAddressPort&) { assert(false); }
void connect(const String& domain) {
if (fail_) {
MainEventLoop::postEvent(boost::bind(boost::ref(onDisconnected), Connection::ConnectionError));
@@ -513,8 +515,8 @@ class SessionTest : public CppUnit::TestFixture {
parser_ = new XMPPParser(this, &payloadParserFactories_);
}
- void handleStreamStart(const String&, const String& to, const String&) {
- CPPUNIT_ASSERT_EQUAL(domain_, to);
+ void handleStreamStart(const ProtocolHeader& header) {
+ CPPUNIT_ASSERT_EQUAL(domain_, header.getTo());
handleEvent(Event::StreamStartEvent);
}
@@ -548,7 +550,11 @@ class SessionTest : public CppUnit::TestFixture {
String serializeEvent(const Event& event) {
switch (event.type) {
case Event::StreamStartEvent:
- return serializer_.serializeHeader("", domain_, "");
+ {
+ ProtocolHeader header;
+ header.setTo(domain_);
+ return serializer_.serializeHeader(header);
+ }
case Event::ElementEvent:
return serializer_.serializeElement(event.element);
case Event::StreamEndEvent: