summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/Client.cpp')
-rw-r--r--Swiften/Client/Client.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index b3bea0d..adda6af 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -50,25 +50,26 @@ void Client::handleConnectionConnectFinished(bool error) {
assert(!sessionStream_);
sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(connection_, &payloadParserFactories_, &payloadSerializers_, tlsLayerFactory_));
sessionStream_->initialize();
-
- session_ = boost::shared_ptr<ClientSession>(new ClientSession(jid_, connection_, tlsLayerFactory_, &payloadParserFactories_, &payloadSerializers_));
if (!certificate_.isEmpty()) {
- session_->setCertificate(PKCS12Certificate(certificate_, password_));
+ sessionStream_->setTLSCertificate(PKCS12Certificate(certificate_, password_));
}
- session_->onSessionStarted.connect(boost::bind(boost::ref(onConnected)));
- session_->onSessionFinished.connect(boost::bind(&Client::handleSessionFinished, this, _1));
- session_->onNeedCredentials.connect(boost::bind(&Client::handleNeedCredentials, this));
- session_->onDataRead.connect(boost::bind(&Client::handleDataRead, this, _1));
- session_->onDataWritten.connect(boost::bind(&Client::handleDataWritten, this, _1));
- session_->onElementReceived.connect(boost::bind(&Client::handleElement, this, _1));
- session_->startSession();
+ //sessionStream_->onDataRead.connect(boost::bind(&Client::handleDataRead, this, _1));
+ //sessionStream_->onDataWritten.connect(boost::bind(&Client::handleDataWritten, this, _1));
+
+ 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));
+ session_->start();
}
}
void Client::disconnect() {
- if (session_) {
- session_->finishSession();
- }
+ // TODO
+ //if (session_) {
+ // session_->finishSession();
+ //}
}
void Client::send(boost::shared_ptr<Stanza> stanza) {
@@ -115,9 +116,10 @@ void Client::setCertificate(const String& certificate) {
certificate_ = certificate;
}
-void Client::handleSessionFinished(const boost::optional<Session::SessionError>& error) {
+void Client::handleSessionFinished(boost::shared_ptr<Error> error) {
if (error) {
ClientError clientError;
+ /*
switch (*error) {
case Session::ConnectionReadError:
clientError = ClientError(ClientError::ConnectionReadError);
@@ -153,6 +155,7 @@ void Client::handleSessionFinished(const boost::optional<Session::SessionError>&
clientError = ClientError(ClientError::ClientCertificateError);
break;
}
+ */
onError(clientError);
}
}