summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-03 11:09:08 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-03 11:09:08 (GMT)
commit10334c139670861d4860da59ad837fc3fe6fd41e (patch)
treeb632360747e635e229f336760ccc76789797a8bf /Swiften/Session
parent8189054fca9c68194ffc328eb7beecf241bbbcd7 (diff)
downloadswift-contrib-10334c139670861d4860da59ad837fc3fe6fd41e.zip
swift-contrib-10334c139670861d4860da59ad837fc3fe6fd41e.tar.bz2
Ensure safety on onDataRead and onDataWritten signals.
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp4
-rw-r--r--Swiften/Session/SessionStream.h5
2 files changed, 5 insertions, 4 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index a1ec907..d08be4f 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -193,11 +193,11 @@ void BasicSessionStream::handleConnectionFinished(const boost::optional<Connecti
}
void BasicSessionStream::handleDataRead(const SafeByteArray& data) {
- onDataRead(byteArrayToString(ByteArray(data.begin(), data.end())));
+ onDataRead(data);
}
void BasicSessionStream::handleDataWritten(const SafeByteArray& data) {
- onDataWritten(byteArrayToString(ByteArray(data.begin(), data.end())));
+ onDataWritten(data);
}
};
diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h
index 38f5d93..e6b9469 100644
--- a/Swiften/Session/SessionStream.h
+++ b/Swiften/Session/SessionStream.h
@@ -13,6 +13,7 @@
#include <Swiften/Elements/ProtocolHeader.h>
#include <Swiften/Elements/Element.h>
#include <Swiften/Base/Error.h>
+#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/TLS/PKCS12Certificate.h>
#include <Swiften/TLS/Certificate.h>
#include <Swiften/TLS/CertificateVerificationError.h>
@@ -71,8 +72,8 @@ namespace Swift {
boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
boost::signal<void (boost::shared_ptr<Error>)> onClosed;
boost::signal<void ()> onTLSEncrypted;
- boost::signal<void (const std::string&)> onDataRead;
- boost::signal<void (const std::string&)> onDataWritten;
+ boost::signal<void (const SafeByteArray&)> onDataRead;
+ boost::signal<void (const SafeByteArray&)> onDataWritten;
protected:
const PKCS12Certificate& getTLSCertificate() const {