diff options
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/Session.cpp | 5 | ||||
-rw-r--r-- | Swiften/Client/UnitTest/SessionTest.cpp | 12 |
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: |