summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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;
};