summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-10 19:29:39 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-10 19:29:39 (GMT)
commit3914231a023e36881c2a760a3d8973ffdd2a18ad (patch)
tree7d1c2d61f1cf74f9369092f8473386dc5e9649a3 /Swiften/Client
parentc682941cd230ad8caed3f3d457de3dc0cd7172d4 (diff)
downloadswift-contrib-3914231a023e36881c2a760a3d8973ffdd2a18ad.zip
swift-contrib-3914231a023e36881c2a760a3d8973ffdd2a18ad.tar.bz2
More Client refactoring.
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/Client.cpp14
-rw-r--r--Swiften/Client/Client.h4
-rw-r--r--Swiften/Client/ClientSession.h6
3 files changed, 12 insertions, 12 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
@@ -49,12 +49,12 @@ void Client::handleConnectionConnectFinished(bool error) {
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)));
@@ -164,12 +164,12 @@ 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);
}
}
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 27c2458..16127dd 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -53,8 +53,8 @@ namespace Swift {
void handleElement(boost::shared_ptr<Element>);
void handleSessionFinished(boost::shared_ptr<Error>);
void handleNeedCredentials();
- void handleDataRead(const ByteArray&);
- void handleDataWritten(const ByteArray&);
+ void handleDataRead(const String&);
+ void handleDataWritten(const String&);
void reset();
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index 1b01a66..e09861b 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -66,9 +66,9 @@ namespace Swift {
void sendStreamHeader();
void sendSessionStart();
- virtual void handleElement(boost::shared_ptr<Element>);
- virtual void handleStreamStart(const ProtocolHeader&);
- virtual void handleStreamError(boost::shared_ptr<Swift::Error>);
+ void handleElement(boost::shared_ptr<Element>);
+ void handleStreamStart(const ProtocolHeader&);
+ void handleStreamError(boost::shared_ptr<Swift::Error>);
void handleTLSEncrypted();