diff options
-rw-r--r-- | Swift/Controllers/MainController.cpp | 4 | ||||
-rw-r--r-- | Swiften/Client/ClientError.h | 10 | ||||
-rw-r--r-- | Swiften/Client/ClientSession.h | 3 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 1 |
4 files changed, 16 insertions, 2 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index c6b6dfc..95094f2 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -659,12 +659,16 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro } else { message = QT_TRANSLATE_NOOP("", "Certificate error"); } } + if (!message.empty() && error->getErrorCode()) { + message = str(format(QT_TRANSLATE_NOOP("", "%1% (%2%)")) % message % error->getErrorCode()->message()); + } + if (forceReconnectAfterCertificateTrust && settings_->getSetting(SettingConstants::FORGET_PASSWORDS)) { forceReconnectAfterCertificateTrust = false; forceSignout = true; message = QT_TRANSLATE_NOOP("", "Re-enter credentials and retry"); } diff --git a/Swiften/Client/ClientError.h b/Swiften/Client/ClientError.h index 5277a0e..19de42b 100644 --- a/Swiften/Client/ClientError.h +++ b/Swiften/Client/ClientError.h @@ -1,14 +1,17 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <boost/shared_ptr.hpp> +#include <boost/system/system_error.hpp> + namespace Swift { class ClientError { public: enum Type { UnknownError, DomainNameResolveError, @@ -48,10 +51,15 @@ namespace Swift { }; ClientError(Type type = UnknownError) : type_(type) {} Type getType() const { return type_; } + void setErrorCode(boost::shared_ptr<boost::system::error_code> errorCode) { errorCode_ = errorCode; } + + boost::shared_ptr<boost::system::error_code> getErrorCode() const { return errorCode_; } + private: Type type_; + boost::shared_ptr<boost::system::error_code> errorCode_; }; } diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index 61de014..9bbc3f2 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once @@ -54,12 +54,13 @@ namespace Swift { ResourceBindError, SessionStartError, TLSClientCertificateError, TLSError, StreamError } type; + boost::shared_ptr<boost::system::error_code> errorCode; Error(Type type) : type(type) {} }; enum UseTLS { NeverUseTLS, UseTLSWhenAvailable, diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index c91e5c5..baebd4a 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -256,12 +256,13 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { clientError = ClientError(ClientError::ClientCertificateError); break; case ClientSession::Error::StreamError: clientError = ClientError(ClientError::StreamError); break; } + clientError.setErrorCode(actualError->errorCode); } else if (boost::shared_ptr<TLSError> actualError = boost::dynamic_pointer_cast<TLSError>(error)) { switch(actualError->getType()) { case TLSError::CertificateCardRemoved: clientError = ClientError(ClientError::CertificateCardRemoved); break; |