summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r--Swiften/StreamStack/CompressionLayer.h16
-rw-r--r--Swiften/StreamStack/ConnectionLayer.cpp21
-rw-r--r--Swiften/StreamStack/ConnectionLayer.h15
-rw-r--r--Swiften/StreamStack/HighLayer.h2
-rw-r--r--Swiften/StreamStack/LowLayer.h2
-rw-r--r--Swiften/StreamStack/SConscript1
-rw-r--r--Swiften/StreamStack/StreamLayer.h4
-rw-r--r--Swiften/StreamStack/StreamStack.cpp10
-rw-r--r--Swiften/StreamStack/StreamStack.h9
-rw-r--r--Swiften/StreamStack/TLSLayer.cpp6
-rw-r--r--Swiften/StreamStack/TLSLayer.h10
-rw-r--r--Swiften/StreamStack/UnitTest/StreamStackTest.cpp16
-rw-r--r--Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp14
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp6
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h2
-rw-r--r--Swiften/StreamStack/XMPPLayer.cpp8
-rw-r--r--Swiften/StreamStack/XMPPLayer.h10
17 files changed, 83 insertions, 69 deletions
diff --git a/Swiften/StreamStack/CompressionLayer.h b/Swiften/StreamStack/CompressionLayer.h
index b8293a8..b10ee52 100644
--- a/Swiften/StreamStack/CompressionLayer.h
+++ b/Swiften/StreamStack/CompressionLayer.h
@@ -7,13 +7,13 @@
#pragma once
#include <boost/noncopyable.hpp>
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/StreamStack/StreamLayer.h"
-#include "Swiften/Compress/ZLibException.h"
-#include "Swiften/Compress/ZLibCompressor.h"
-#include "Swiften/Compress/ZLibDecompressor.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/StreamStack/StreamLayer.h>
+#include <Swiften/Compress/ZLibException.h>
+#include <Swiften/Compress/ZLibCompressor.h>
+#include <Swiften/Compress/ZLibDecompressor.h>
namespace Swift {
class ZLibCompressor;
@@ -27,7 +27,7 @@ namespace Swift {
try {
writeDataToChildLayer(compressor_.process(data));
}
- catch (const ZLibException& e) {
+ catch (const ZLibException&) {
onError();
}
}
@@ -36,7 +36,7 @@ namespace Swift {
try {
writeDataToParentLayer(decompressor_.process(data));
}
- catch (const ZLibException& e) {
+ catch (const ZLibException&) {
onError();
}
}
diff --git a/Swiften/StreamStack/ConnectionLayer.cpp b/Swiften/StreamStack/ConnectionLayer.cpp
new file mode 100644
index 0000000..00b4289
--- /dev/null
+++ b/Swiften/StreamStack/ConnectionLayer.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/StreamStack/ConnectionLayer.h>
+#include <boost/bind.hpp>
+
+namespace Swift {
+
+ConnectionLayer::ConnectionLayer(boost::shared_ptr<Connection> connection) : connection(connection) {
+ connection->onDataRead.connect(boost::bind(&ConnectionLayer::writeDataToParentLayer, this, _1));
+}
+
+ConnectionLayer::~ConnectionLayer() {
+ connection->onDataRead.disconnect(boost::bind(&ConnectionLayer::writeDataToParentLayer, this, _1));
+}
+
+
+}
diff --git a/Swiften/StreamStack/ConnectionLayer.h b/Swiften/StreamStack/ConnectionLayer.h
index 0da0900..fc33e48 100644
--- a/Swiften/StreamStack/ConnectionLayer.h
+++ b/Swiften/StreamStack/ConnectionLayer.h
@@ -6,23 +6,16 @@
#pragma once
-#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/Network/Connection.h"
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/Network/Connection.h>
namespace Swift {
class ConnectionLayer : public LowLayer {
public:
- ConnectionLayer(boost::shared_ptr<Connection> connection) : connection(connection) {
- connection->onDataRead.connect(boost::bind(&ConnectionLayer::writeDataToParentLayer, this, _1));
- }
-
- ~ConnectionLayer() {
- connection->onDataRead.disconnect(boost::bind(&ConnectionLayer::writeDataToParentLayer, this, _1));
- }
+ ConnectionLayer(boost::shared_ptr<Connection> connection);
+ ~ConnectionLayer();
void writeData(const ByteArray& data) {
connection->write(data);
diff --git a/Swiften/StreamStack/HighLayer.h b/Swiften/StreamStack/HighLayer.h
index ca983f9..b96458f 100644
--- a/Swiften/StreamStack/HighLayer.h
+++ b/Swiften/StreamStack/HighLayer.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Base/ByteArray.h"
+#include <Swiften/Base/ByteArray.h>
namespace Swift {
class LowLayer;
diff --git a/Swiften/StreamStack/LowLayer.h b/Swiften/StreamStack/LowLayer.h
index 1f9645a..87eb3de 100644
--- a/Swiften/StreamStack/LowLayer.h
+++ b/Swiften/StreamStack/LowLayer.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Base/ByteArray.h"
+#include <Swiften/Base/ByteArray.h>
namespace Swift {
class HighLayer;
diff --git a/Swiften/StreamStack/SConscript b/Swiften/StreamStack/SConscript
index 022c695..06fcc03 100644
--- a/Swiften/StreamStack/SConscript
+++ b/Swiften/StreamStack/SConscript
@@ -6,6 +6,7 @@ sources = [
"HighLayer.cpp",
"LowLayer.cpp",
"StreamStack.cpp",
+ "ConnectionLayer.cpp",
"TLSLayer.cpp",
"WhitespacePingLayer.cpp",
"XMPPLayer.cpp",
diff --git a/Swiften/StreamStack/StreamLayer.h b/Swiften/StreamStack/StreamLayer.h
index bcc5d79..09bb5b3 100644
--- a/Swiften/StreamStack/StreamLayer.h
+++ b/Swiften/StreamStack/StreamLayer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/StreamStack/HighLayer.h"
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/StreamStack/HighLayer.h>
namespace Swift {
class StreamLayer : public LowLayer, public HighLayer {
diff --git a/Swiften/StreamStack/StreamStack.cpp b/Swiften/StreamStack/StreamStack.cpp
index 2a30768..78409f7 100644
--- a/Swiften/StreamStack/StreamStack.cpp
+++ b/Swiften/StreamStack/StreamStack.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/StreamStack/StreamStack.h"
+#include <Swiften/StreamStack/StreamStack.h>
#include <boost/bind.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/StreamStack/XMPPLayer.h"
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/StreamStack/StreamLayer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/StreamStack/XMPPLayer.h>
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/StreamStack/StreamLayer.h>
namespace Swift {
diff --git a/Swiften/StreamStack/StreamStack.h b/Swiften/StreamStack/StreamStack.h
index 562245e..30e17ce 100644
--- a/Swiften/StreamStack/StreamStack.h
+++ b/Swiften/StreamStack/StreamStack.h
@@ -7,11 +7,10 @@
#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
#include <vector>
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Base/foreach.h"
+#include <Swiften/Elements/Stanza.h>
namespace Swift {
class XMPPLayer;
@@ -30,8 +29,8 @@ namespace Swift {
}
template<typename T> T* getLayer() {
- foreach(StreamLayer* streamLayer, layers_) {
- T* layer = dynamic_cast<T*>(streamLayer);
+ for (size_t i = 0; i < layers_.size(); ++i) {
+ T* layer = dynamic_cast<T*>(layers_[i]);
if (layer) {
return layer;
}
diff --git a/Swiften/StreamStack/TLSLayer.cpp b/Swiften/StreamStack/TLSLayer.cpp
index 8a6c008..707b700 100644
--- a/Swiften/StreamStack/TLSLayer.cpp
+++ b/Swiften/StreamStack/TLSLayer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/StreamStack/TLSLayer.h"
+#include <Swiften/StreamStack/TLSLayer.h>
#include <boost/bind.hpp>
-#include "Swiften/TLS/TLSContextFactory.h"
-#include "Swiften/TLS/TLSContext.h"
+#include <Swiften/TLS/TLSContextFactory.h>
+#include <Swiften/TLS/TLSContext.h>
namespace Swift {
diff --git a/Swiften/StreamStack/TLSLayer.h b/Swiften/StreamStack/TLSLayer.h
index 22e9aef..bec63ee 100644
--- a/Swiften/StreamStack/TLSLayer.h
+++ b/Swiften/StreamStack/TLSLayer.h
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/StreamStack/StreamLayer.h"
-#include "Swiften/TLS/Certificate.h"
-#include "Swiften/TLS/CertificateVerificationError.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/StreamStack/StreamLayer.h>
+#include <Swiften/TLS/Certificate.h>
+#include <Swiften/TLS/CertificateVerificationError.h>
namespace Swift {
class TLSContext;
diff --git a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp
index be16baa..8b2e85c 100644
--- a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp
+++ b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Base/ByteArray.h"
+#include <Swiften/Base/ByteArray.h>
#include <vector>
#include <boost/bind.hpp>
@@ -12,13 +12,13 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/StreamStack/StreamStack.h"
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/StreamStack/XMPPLayer.h"
-#include "Swiften/StreamStack/StreamLayer.h"
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/StreamStack/StreamStack.h>
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/StreamStack/XMPPLayer.h>
+#include <Swiften/StreamStack/StreamLayer.h>
+#include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
using namespace Swift;
diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
index 9d5e745..f6a75c1 100644
--- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
+++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
@@ -9,13 +9,13 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Elements/ProtocolHeader.h"
-#include "Swiften/Elements/Presence.h"
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/StreamStack/XMPPLayer.h"
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
+#include <Swiften/Elements/ProtocolHeader.h>
+#include <Swiften/Elements/Presence.h>
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/StreamStack/XMPPLayer.h>
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
using namespace Swift;
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp
index 35efc3c..9fb4b06 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.cpp
+++ b/Swiften/StreamStack/WhitespacePingLayer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/StreamStack/WhitespacePingLayer.h"
+#include <Swiften/StreamStack/WhitespacePingLayer.h>
#include <boost/bind.hpp>
-#include "Swiften/Network/TimerFactory.h"
-#include "Swiften/Network/Timer.h"
+#include <Swiften/Network/TimerFactory.h>
+#include <Swiften/Network/Timer.h>
namespace Swift {
diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h
index 0532bbd..7c42c29 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.h
+++ b/Swiften/StreamStack/WhitespacePingLayer.h
@@ -9,7 +9,7 @@
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
-#include "Swiften/StreamStack/StreamLayer.h"
+#include <Swiften/StreamStack/StreamLayer.h>
namespace Swift {
class Timer;
diff --git a/Swiften/StreamStack/XMPPLayer.cpp b/Swiften/StreamStack/XMPPLayer.cpp
index 684dfe6..3c7dcb4 100644
--- a/Swiften/StreamStack/XMPPLayer.cpp
+++ b/Swiften/StreamStack/XMPPLayer.cpp
@@ -4,10 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/StreamStack/XMPPLayer.h"
-#include "Swiften/Parser/XMPPParser.h"
-#include "Swiften/Serializer/XMPPSerializer.h"
-#include "Swiften/Elements/ProtocolHeader.h"
+#include <Swiften/StreamStack/XMPPLayer.h>
+#include <Swiften/Parser/XMPPParser.h>
+#include <Swiften/Serializer/XMPPSerializer.h>
+#include <Swiften/Elements/ProtocolHeader.h>
namespace Swift {
diff --git a/Swiften/StreamStack/XMPPLayer.h b/Swiften/StreamStack/XMPPLayer.h
index 6669cda..72d0e7e 100644
--- a/Swiften/StreamStack/XMPPLayer.h
+++ b/Swiften/StreamStack/XMPPLayer.h
@@ -7,14 +7,14 @@
#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
#include <boost/noncopyable.hpp>
#include <Swiften/StreamStack/HighLayer.h>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Element.h"
-#include "Swiften/Elements/StreamType.h"
-#include "Swiften/Parser/XMPPParserClient.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Elements/Element.h>
+#include <Swiften/Elements/StreamType.h>
+#include <Swiften/Parser/XMPPParserClient.h>
namespace Swift {
class ProtocolHeader;