diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-11-08 16:12:48 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-11-08 18:32:15 (GMT) |
commit | f1d74218cb432513c376b46aa115acb3e107ed3a (patch) | |
tree | 24df6a3233f1fd3c2c2592637cfcfd1846040dee /Swift/Controllers/ChatControllerBase.cpp | |
parent | b6003bea740e8898127ec135e230eed421924370 (diff) | |
download | swift-contrib-f1d74218cb432513c376b46aa115acb3e107ed3a.zip swift-contrib-f1d74218cb432513c376b46aa115acb3e107ed3a.tar.bz2 |
Added Error class.
Diffstat (limited to 'Swift/Controllers/ChatControllerBase.cpp')
-rw-r--r-- | Swift/Controllers/ChatControllerBase.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Swift/Controllers/ChatControllerBase.cpp b/Swift/Controllers/ChatControllerBase.cpp index baa715b..2b873f1 100644 --- a/Swift/Controllers/ChatControllerBase.cpp +++ b/Swift/Controllers/ChatControllerBase.cpp @@ -67,7 +67,7 @@ void ChatControllerBase::handleSendMessageRequest(const String &body) { postSendMessage(message->getBody()); } -void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, const boost::optional<Error>& error) { +void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, const boost::optional<ErrorPayload>& error) { if (!error) { if (catalog->getLabels().size() == 0) { chatWindow_->setSecurityLabelsEnabled(false); @@ -97,7 +97,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m preHandleIncomingMessage(message); String body = message->getBody(); if (message->isError()) { - String errorMessage = getErrorMessage(message->getPayload<Error>()); + String errorMessage = getErrorMessage(message->getPayload<ErrorPayload>()); chatWindow_->addErrorMessage(errorMessage); } else { @@ -109,35 +109,35 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } } -String ChatControllerBase::getErrorMessage(boost::shared_ptr<Error> error) { +String ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) { String defaultMessage = "Error sending message"; if (!error->getText().isEmpty()) { return error->getText(); } else { switch (error->getCondition()) { - case Error::BadRequest: return defaultMessage; break; - case Error::Conflict: return defaultMessage; break; - case Error::FeatureNotImplemented: return defaultMessage; break; - case Error::Forbidden: return defaultMessage; break; - case Error::Gone: return "Recipient can no longer be contacted"; break; - case Error::InternalServerError: return "Internal server error"; break; - case Error::ItemNotFound: return defaultMessage; break; - case Error::JIDMalformed: return defaultMessage; break; - case Error::NotAcceptable: return "Message was rejected"; break; - case Error::NotAllowed: return defaultMessage; break; - case Error::NotAuthorized: return defaultMessage; break; - case Error::PaymentRequired: return defaultMessage; break; - case Error::RecipientUnavailable: return "Recipient is unavailable."; break; - case Error::Redirect: return defaultMessage; break; - case Error::RegistrationRequired: return defaultMessage; break; - case Error::RemoteServerNotFound: return "Recipient's server not found."; break; - case Error::RemoteServerTimeout: return defaultMessage; break; - case Error::ResourceConstraint: return defaultMessage; break; - case Error::ServiceUnavailable: return defaultMessage; break; - case Error::SubscriptionRequired: return defaultMessage; break; - case Error::UndefinedCondition: return defaultMessage; break; - case Error::UnexpectedRequest: return defaultMessage; break; + case ErrorPayload::BadRequest: return defaultMessage; break; + case ErrorPayload::Conflict: return defaultMessage; break; + case ErrorPayload::FeatureNotImplemented: return defaultMessage; break; + case ErrorPayload::Forbidden: return defaultMessage; break; + case ErrorPayload::Gone: return "Recipient can no longer be contacted"; break; + case ErrorPayload::InternalServerError: return "Internal server error"; break; + case ErrorPayload::ItemNotFound: return defaultMessage; break; + case ErrorPayload::JIDMalformed: return defaultMessage; break; + case ErrorPayload::NotAcceptable: return "Message was rejected"; break; + case ErrorPayload::NotAllowed: return defaultMessage; break; + case ErrorPayload::NotAuthorized: return defaultMessage; break; + case ErrorPayload::PaymentRequired: return defaultMessage; break; + case ErrorPayload::RecipientUnavailable: return "Recipient is unavailable."; break; + case ErrorPayload::Redirect: return defaultMessage; break; + case ErrorPayload::RegistrationRequired: return defaultMessage; break; + case ErrorPayload::RemoteServerNotFound: return "Recipient's server not found."; break; + case ErrorPayload::RemoteServerTimeout: return defaultMessage; break; + case ErrorPayload::ResourceConstraint: return defaultMessage; break; + case ErrorPayload::ServiceUnavailable: return defaultMessage; break; + case ErrorPayload::SubscriptionRequired: return defaultMessage; break; + case ErrorPayload::UndefinedCondition: return defaultMessage; break; + case ErrorPayload::UnexpectedRequest: return defaultMessage; break; } } return defaultMessage; |