summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-09-15 16:46:52 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-09-15 16:47:53 (GMT)
commit8e596c2c0c9155830bb6e00204301bb0333274a5 (patch)
treeb1a01d330ef9fb45c623aaba503ad0e9797c3e91
parent5159571a0464c28ce376de22faaa52066168a205 (diff)
downloadswift-contrib-8e596c2c0c9155830bb6e00204301bb0333274a5.zip
swift-contrib-8e596c2c0c9155830bb6e00204301bb0333274a5.tar.bz2
Display useful errors in chats when server doesn't include <text>.
Resolves: #264
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp34
-rw-r--r--Swift/QtUI/QtChatWindow.cpp2
2 files changed, 18 insertions, 18 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 249c433..ffaf3af 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -190,28 +190,28 @@ String ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error
}
else {
switch (error->getCondition()) {
- 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::BadRequest: return "Bad request"; break;
+ case ErrorPayload::Conflict: return "Conflict"; break;
+ case ErrorPayload::FeatureNotImplemented: return "This feature is not implemented"; break;
+ case ErrorPayload::Forbidden: return "Forbidden"; 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::ItemNotFound: return "Item not found"; break;
+ case ErrorPayload::JIDMalformed: return "JID Malformed"; 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::NotAllowed: return "Not allowed"; break;
+ case ErrorPayload::NotAuthorized: return "Not authorized"; break;
+ case ErrorPayload::PaymentRequired: return "Payment is required"; break;
case ErrorPayload::RecipientUnavailable: return "Recipient is unavailable."; break;
- case ErrorPayload::Redirect: return defaultMessage; break;
- case ErrorPayload::RegistrationRequired: return defaultMessage; break;
+ case ErrorPayload::Redirect: return "Redirect"; break;
+ case ErrorPayload::RegistrationRequired: return "Registration required"; 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;
+ case ErrorPayload::RemoteServerTimeout: return "Remote server timeout"; break;
+ case ErrorPayload::ResourceConstraint: return "The server is low on resources"; break;
+ case ErrorPayload::ServiceUnavailable: return "The service is unavailable"; break;
+ case ErrorPayload::SubscriptionRequired: return "A subscription is required"; break;
+ case ErrorPayload::UndefinedCondition: return "Undefined condition"; break;
+ case ErrorPayload::UnexpectedRequest: return "Unexpected request"; break;
}
}
return defaultMessage;
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 2955ee4..a927988 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -303,7 +303,7 @@ void QtChatWindow::addErrorMessage(const String& errorMessage) {
QString errorMessageHTML(Qt::escape(P2QSTRING(errorMessage)));
errorMessageHTML.replace("\n","<br/>");
- messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(QString("<span class=\"error\">%1</span>").arg(errorMessageHTML), QDateTime::currentDateTime(), false, theme_)));
+ messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(QString("<span class=\"error\">Couldn't send message: %1</span>").arg(errorMessageHTML), QDateTime::currentDateTime(), false, theme_)));
previousMessageWasSelf_ = false;
previousMessageWasSystem_ = true;