summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-18 16:22:06 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-18 16:50:18 (GMT)
commit8472194d716e0e3b95a66bf5be45c246ee79d0af (patch)
treeb9f473e0e606b012ee5013e85d2cf5e7523b7029 /Swiften/Session
parentb1b3b8f88517ad8b14795cc8a6265962d2935be3 (diff)
downloadswift-contrib-8472194d716e0e3b95a66bf5be45c246ee79d0af.zip
swift-contrib-8472194d716e0e3b95a66bf5be45c246ee79d0af.tar.bz2
Propagate use of SafeByteArray down to the connection.
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp8
-rw-r--r--Swiften/Session/BasicSessionStream.h5
-rw-r--r--Swiften/Session/Session.h6
-rw-r--r--Swiften/Session/SessionTracer.cpp4
-rw-r--r--Swiften/Session/SessionTracer.h4
5 files changed, 14 insertions, 13 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 579631f..a1ec907 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -192,12 +192,12 @@ void BasicSessionStream::handleConnectionFinished(const boost::optional<Connecti
}
}
-void BasicSessionStream::handleDataRead(const ByteArray& data) {
- onDataRead(byteArrayToString(data));
+void BasicSessionStream::handleDataRead(const SafeByteArray& data) {
+ onDataRead(byteArrayToString(ByteArray(data.begin(), data.end())));
}
-void BasicSessionStream::handleDataWritten(const ByteArray& data) {
- onDataWritten(byteArrayToString(data));
+void BasicSessionStream::handleDataWritten(const SafeByteArray& data) {
+ onDataWritten(byteArrayToString(ByteArray(data.begin(), data.end())));
}
};
diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h
index d2be2d3..2a1ed8a 100644
--- a/Swiften/Session/BasicSessionStream.h
+++ b/Swiften/Session/BasicSessionStream.h
@@ -8,6 +8,7 @@
#include <boost/shared_ptr.hpp>
+#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Network/Connection.h>
#include <Swiften/Session/SessionStream.h>
#include <Swiften/Elements/StreamType.h>
@@ -64,8 +65,8 @@ namespace Swift {
void handleTLSError();
void handleStreamStartReceived(const ProtocolHeader&);
void handleElementReceived(boost::shared_ptr<Element>);
- void handleDataRead(const ByteArray& data);
- void handleDataWritten(const ByteArray& data);
+ void handleDataRead(const SafeByteArray& data);
+ void handleDataWritten(const SafeByteArray& data);
private:
bool available;
diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h
index 04ae8d5..9e954c7 100644
--- a/Swiften/Session/Session.h
+++ b/Swiften/Session/Session.h
@@ -15,7 +15,7 @@
#include <Swiften/Elements/Element.h>
#include <Swiften/Network/Connection.h>
#include <Swiften/StreamStack/ConnectionLayer.h>
-#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
class ProtocolHeader;
@@ -63,8 +63,8 @@ namespace Swift {
boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished;
- boost::signal<void (const ByteArray&)> onDataWritten;
- boost::signal<void (const ByteArray&)> onDataRead;
+ boost::signal<void (const SafeByteArray&)> onDataWritten;
+ boost::signal<void (const SafeByteArray&)> onDataRead;
protected:
void setRemoteJID(const JID& j) {
diff --git a/Swiften/Session/SessionTracer.cpp b/Swiften/Session/SessionTracer.cpp
index 060109b..e0a39bf 100644
--- a/Swiften/Session/SessionTracer.cpp
+++ b/Swiften/Session/SessionTracer.cpp
@@ -16,13 +16,13 @@ SessionTracer::SessionTracer(boost::shared_ptr<Session> session) : session(sessi
session->onDataWritten.connect(boost::bind(&SessionTracer::printData, this, '>', _1));
}
-void SessionTracer::printData(char direction, const ByteArray& data) {
+void SessionTracer::printData(char direction, const SafeByteArray& data) {
std::cerr << direction << direction << " " << session->getLocalJID() << " ";
for (unsigned int i = 0; i < 72 - session->getLocalJID().toString().size() - session->getRemoteJID().toString().size(); ++i) {
std::cerr << direction;
}
std::cerr << " " << session->getRemoteJID()<< " " << direction << direction << std::endl;
- std::cerr << byteArrayToString(data) << std::endl;
+ std::cerr << byteArrayToString(ByteArray(data.begin(), data.end())) << std::endl;
}
}
diff --git a/Swiften/Session/SessionTracer.h b/Swiften/Session/SessionTracer.h
index 4e45957..72c93b4 100644
--- a/Swiften/Session/SessionTracer.h
+++ b/Swiften/Session/SessionTracer.h
@@ -9,7 +9,7 @@
#include <string>
#include <Swiften/Session/Session.h>
-#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
class SessionTracer {
@@ -17,7 +17,7 @@ namespace Swift {
SessionTracer(boost::shared_ptr<Session> session);
private:
- void printData(char direction, const ByteArray& data);
+ void printData(char direction, const SafeByteArray& data);
boost::shared_ptr<Session> session;
};