diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-30 14:11:35 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-30 17:44:46 (GMT) |
commit | 59be74ec6fc7bc495f2a261b8f274b8555aee306 (patch) | |
tree | 915be433534956f9316ba41220c064af77b9da90 /Swiften/Client | |
parent | c759220a7fcd824a7a842a468c660558fa1a1cf1 (diff) | |
download | swift-contrib-59be74ec6fc7bc495f2a261b8f274b8555aee306.zip swift-contrib-59be74ec6fc7bc495f2a261b8f274b8555aee306.tar.bz2 |
Changed CoreClient::onError to CoreClient::onDisconnected.
The error parameter is optional.
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 8 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.h | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index fa9dca0..9511dfb 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -73,9 +73,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio connector_->onConnectFinished.disconnect(boost::bind(&CoreClient::handleConnectorFinished, this, _1)); connector_.reset(); if (!connection) { - if (!disconnectRequested_) { - onError(ClientError::ConnectionError); - } + onDisconnected(disconnectRequested_ ? boost::optional<ClientError>() : boost::optional<ClientError>(ClientError::ConnectionError)); } else { assert(!connection_); @@ -131,6 +129,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { connection_->disconnect(); connection_.reset(); + boost::optional<ClientError> actualError; if (error) { ClientError clientError; if (boost::shared_ptr<ClientSession::Error> actualError = boost::dynamic_pointer_cast<ClientSession::Error>(error)) { @@ -183,8 +182,9 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { break; } } - onError(clientError); + actualError = boost::optional<ClientError>(clientError); } + onDisconnected(actualError); } void CoreClient::handleNeedCredentials() { diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index f6e0b6d..e9e81ec 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -126,9 +126,12 @@ namespace Swift { public: /** - * Emitted when a non-recoverable error occurs. + * Emitted when the client was disconnected from the network. + * + * If the connection was due to a non-recoverable error, the type + * of error will be passed as a parameter. */ - boost::signal<void (const ClientError&)> onError; + boost::signal<void (const boost::optional<ClientError>&)> onDisconnected; /** * Emitted when the client is connected and authenticated, |