summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/Client.cpp')
-rw-r--r--Swiften/Client/Client.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index adda6af..9fb4ca0 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -46,18 +46,18 @@ void Client::handleConnectionConnectFinished(bool error) {
if (error) {
onError(ClientError::ConnectionError);
}
else {
assert(!sessionStream_);
sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(connection_, &payloadParserFactories_, &payloadSerializers_, tlsLayerFactory_));
- sessionStream_->initialize();
if (!certificate_.isEmpty()) {
sessionStream_->setTLSCertificate(PKCS12Certificate(certificate_, password_));
}
- //sessionStream_->onDataRead.connect(boost::bind(&Client::handleDataRead, this, _1));
- //sessionStream_->onDataWritten.connect(boost::bind(&Client::handleDataWritten, this, _1));
+ sessionStream_->onDataRead.connect(boost::bind(&Client::handleDataRead, shared_from_this(), _1));
+ sessionStream_->onDataWritten.connect(boost::bind(&Client::handleDataWritten, shared_from_this(), _1));
+ sessionStream_->initialize();
session_ = boost::shared_ptr<ClientSession>(new ClientSession(jid_, sessionStream_));
session_->onInitialized.connect(boost::bind(boost::ref(onConnected)));
session_->onFinished.connect(boost::bind(&Client::handleSessionFinished, shared_from_this(), _1));
session_->onNeedCredentials.connect(boost::bind(&Client::handleNeedCredentials, shared_from_this()));
session_->onElementReceived.connect(boost::bind(&Client::handleElement, shared_from_this(), _1));
@@ -161,15 +161,15 @@ void Client::handleSessionFinished(boost::shared_ptr<Error> error) {
}
void Client::handleNeedCredentials() {
session_->sendCredentials(password_);
}
-void Client::handleDataRead(const ByteArray& data) {
- onDataRead(String(data.getData(), data.getSize()));
+void Client::handleDataRead(const String& data) {
+ onDataRead(data);
}
-void Client::handleDataWritten(const ByteArray& data) {
- onDataWritten(String(data.getData(), data.getSize()));
+void Client::handleDataWritten(const String& data) {
+ onDataWritten(data);
}
}