diff options
| author | Remko Tronçon <git@el-tramo.be> | 2011-10-07 18:09:30 (GMT) |
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2011-10-07 18:09:30 (GMT) |
| commit | 6b98253a4127c975bd59b6a49ddb203337a8c32b (patch) | |
| tree | 546a24e1687f50e403215152d65e21971568f166 /Swiften/Session/BasicSessionStream.cpp | |
| parent | b2f58c4f3eb93e3a32062670df5eb6682aed273a (diff) | |
| download | swift-contrib-6b98253a4127c975bd59b6a49ddb203337a8c32b.zip swift-contrib-6b98253a4127c975bd59b6a49ddb203337a8c32b.tar.bz2 | |
Hoist XML parser factory creation out of Swiften.
Diffstat (limited to 'Swiften/Session/BasicSessionStream.cpp')
| -rw-r--r-- | Swiften/Session/BasicSessionStream.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index d08be4f..07a04b8 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -1,74 +1,75 @@ /* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swiften/Session/BasicSessionStream.h> #include <boost/bind.hpp> #include <Swiften/StreamStack/XMPPLayer.h> #include <Swiften/StreamStack/StreamStack.h> #include <Swiften/StreamStack/ConnectionLayer.h> #include <Swiften/StreamStack/WhitespacePingLayer.h> #include <Swiften/StreamStack/CompressionLayer.h> #include <Swiften/StreamStack/TLSLayer.h> #include <Swiften/TLS/TLSContextFactory.h> #include <Swiften/TLS/TLSContext.h> namespace Swift { BasicSessionStream::BasicSessionStream( StreamType streamType, boost::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, TLSContextFactory* tlsContextFactory, - TimerFactory* timerFactory) : + TimerFactory* timerFactory, + XMLParserFactory* xmlParserFactory) : available(false), connection(connection), payloadParserFactories(payloadParserFactories), payloadSerializers(payloadSerializers), tlsContextFactory(tlsContextFactory), timerFactory(timerFactory), streamType(streamType), compressionLayer(NULL), tlsLayer(NULL), whitespacePingLayer(NULL) { - xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, streamType); + xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType); xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1)); xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1)); xmppLayer->onError.connect(boost::bind(&BasicSessionStream::handleXMPPError, this)); xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, this, _1)); xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1)); connection->onDisconnected.connect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1)); connectionLayer = new ConnectionLayer(connection); streamStack = new StreamStack(xmppLayer, connectionLayer); available = true; } BasicSessionStream::~BasicSessionStream() { delete compressionLayer; if (tlsLayer) { tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this)); tlsLayer->onConnected.disconnect(boost::bind(&BasicSessionStream::handleTLSConnected, this)); delete tlsLayer; } delete whitespacePingLayer; delete streamStack; connection->onDisconnected.disconnect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1)); delete connectionLayer; xmppLayer->onStreamStart.disconnect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1)); xmppLayer->onElement.disconnect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1)); xmppLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleXMPPError, this)); xmppLayer->onDataRead.disconnect(boost::bind(&BasicSessionStream::handleDataRead, this, _1)); xmppLayer->onWriteData.disconnect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1)); delete xmppLayer; } |
Swift