diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-11-10 21:24:03 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-11-10 21:24:03 (GMT) |
commit | 54781ce12f7654f8136e645d4ebc5934d90c6bea (patch) | |
tree | 90bad869f9f64d57a3c0af209b83a538a47c7762 /Swift | |
parent | fcfac59db5cb4503554f2b30854b2e91928296f6 (diff) | |
parent | 66ced3654ad295478b33d3e4f1716f66ab4048b5 (diff) | |
download | swift-contrib-54781ce12f7654f8136e645d4ebc5934d90c6bea.zip swift-contrib-54781ce12f7654f8136e645d4ebc5934d90c6bea.tar.bz2 |
Refactored session management.
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/ChatControllerBase.cpp | 50 | ||||
-rw-r--r-- | Swift/Controllers/ChatControllerBase.h | 6 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 6 |
4 files changed, 33 insertions, 33 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; diff --git a/Swift/Controllers/ChatControllerBase.h b/Swift/Controllers/ChatControllerBase.h index 601e56b..91b72a8 100644 --- a/Swift/Controllers/ChatControllerBase.h +++ b/Swift/Controllers/ChatControllerBase.h @@ -12,7 +12,7 @@ #include "Swiften/Events/MessageEvent.h" #include "Swiften/JID/JID.h" #include "Swiften/Elements/SecurityLabelsCatalog.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" #include "Swiften/Presence/PresenceOracle.h" #include "Swiften/Queries/IQRouter.h" @@ -44,8 +44,8 @@ namespace Swift { private: void handleSendMessageRequest(const String &body); void handleAllMessagesRead(); - void handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog>, const boost::optional<Error>& error); - String getErrorMessage(boost::shared_ptr<Error>); + void handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog>, const boost::optional<ErrorPayload>& error); + String getErrorMessage(boost::shared_ptr<ErrorPayload>); protected: JID selfJID_; diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 9df2308..6c60783 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -389,7 +389,7 @@ void MainController::handleIncomingMessage(boost::shared_ptr<Message> message) { } } -void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, const boost::optional<Error>& error) { +void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, const boost::optional<ErrorPayload>& error) { if (!error) { serverDiscoInfo_ = info; foreach (JIDChatControllerPair pair, chatControllers_) { @@ -405,7 +405,7 @@ bool MainController::isMUC(const JID& jid) const { return mucControllers_.find(jid.toBare()) != mucControllers_.end(); } -void MainController::handleOwnVCardReceived(boost::shared_ptr<VCard> vCard, const boost::optional<Error>& error) { +void MainController::handleOwnVCardReceived(boost::shared_ptr<VCard> vCard, const boost::optional<ErrorPayload>& error) { if (!error && !vCard->getPhoto().isEmpty()) { vCardPhotoHash_ = SHA1::getHexHash(vCard->getPhoto()); if (lastSentPresence_) { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 3179df9..db6a110 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -10,7 +10,7 @@ #include "Swiften/JID/JID.h" #include "Swiften/Elements/VCard.h" #include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/Message.h" #include "Swiften/Settings/SettingsProvider.h" @@ -64,9 +64,9 @@ namespace Swift { void handleIncomingMessage(boost::shared_ptr<Message> message); void handleChangeStatusRequest(StatusShow::Type show, const String &statusText); void handleError(const ClientError& error); - void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, const boost::optional<Error>&); + void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, const boost::optional<ErrorPayload>&); void handleEventQueueLengthChange(int count); - void handleOwnVCardReceived(boost::shared_ptr<VCard> vCard, const boost::optional<Error>& error); + void handleOwnVCardReceived(boost::shared_ptr<VCard> vCard, const boost::optional<ErrorPayload>& error); ChatController* getChatController(const JID &contact); void sendPresence(boost::shared_ptr<Presence> presence); void handleInputIdle(); |