summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-08 16:12:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-08 18:32:15 (GMT)
commitf1d74218cb432513c376b46aa115acb3e107ed3a (patch)
tree24df6a3233f1fd3c2c2592637cfcfd1846040dee /Swiften/Serializer/PayloadSerializers
parentb6003bea740e8898127ec135e230eed421924370 (diff)
downloadswift-contrib-f1d74218cb432513c376b46aa115acb3e107ed3a.zip
swift-contrib-f1d74218cb432513c376b46aa115acb3e107ed3a.tar.bz2
Added Error class.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp54
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.h6
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp2
3 files changed, 31 insertions, 31 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
index 347e1a5..f5ce478 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
@@ -3,43 +3,43 @@
namespace Swift {
-ErrorSerializer::ErrorSerializer() : GenericPayloadSerializer<Error>() {
+ErrorSerializer::ErrorSerializer() : GenericPayloadSerializer<ErrorPayload>() {
}
-String ErrorSerializer::serializePayload(boost::shared_ptr<Error> error) const {
+String ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const {
String result("<error type=\"");
switch (error->getType()) {
- case Error::Continue: result += "continue"; break;
- case Error::Modify: result += "modify"; break;
- case Error::Auth: result += "auth"; break;
- case Error::Wait: result += "wait"; break;
+ case ErrorPayload::Continue: result += "continue"; break;
+ case ErrorPayload::Modify: result += "modify"; break;
+ case ErrorPayload::Auth: result += "auth"; break;
+ case ErrorPayload::Wait: result += "wait"; break;
default: result += "cancel"; break;
}
result += "\">";
String conditionElement;
switch (error->getCondition()) {
- case Error::BadRequest: conditionElement = "bad-request"; break;
- case Error::Conflict: conditionElement = "conflict"; break;
- case Error::FeatureNotImplemented: conditionElement = "feature-not-implemented"; break;
- case Error::Forbidden: conditionElement = "forbidden"; break;
- case Error::Gone: conditionElement = "gone"; break;
- case Error::InternalServerError: conditionElement = "internal-server-error"; break;
- case Error::ItemNotFound: conditionElement = "item-not-found"; break;
- case Error::JIDMalformed: conditionElement = "jid-malformed"; break;
- case Error::NotAcceptable: conditionElement = "not-acceptable"; break;
- case Error::NotAllowed: conditionElement = "not-allowed"; break;
- case Error::NotAuthorized: conditionElement = "not-authorized"; break;
- case Error::PaymentRequired: conditionElement = "payment-required"; break;
- case Error::RecipientUnavailable: conditionElement = "recipient-unavailable"; break;
- case Error::Redirect: conditionElement = "redirect"; break;
- case Error::RegistrationRequired: conditionElement = "registration-required"; break;
- case Error::RemoteServerNotFound: conditionElement = "remote-server-not-found"; break;
- case Error::RemoteServerTimeout: conditionElement = "remote-server-timeout"; break;
- case Error::ResourceConstraint: conditionElement = "resource-constraint"; break;
- case Error::ServiceUnavailable: conditionElement = "service-unavailable"; break;
- case Error::SubscriptionRequired: conditionElement = "subscription-required"; break;
- case Error::UnexpectedRequest: conditionElement = "unexpected-request"; break;
+ case ErrorPayload::BadRequest: conditionElement = "bad-request"; break;
+ case ErrorPayload::Conflict: conditionElement = "conflict"; break;
+ case ErrorPayload::FeatureNotImplemented: conditionElement = "feature-not-implemented"; break;
+ case ErrorPayload::Forbidden: conditionElement = "forbidden"; break;
+ case ErrorPayload::Gone: conditionElement = "gone"; break;
+ case ErrorPayload::InternalServerError: conditionElement = "internal-server-error"; break;
+ case ErrorPayload::ItemNotFound: conditionElement = "item-not-found"; break;
+ case ErrorPayload::JIDMalformed: conditionElement = "jid-malformed"; break;
+ case ErrorPayload::NotAcceptable: conditionElement = "not-acceptable"; break;
+ case ErrorPayload::NotAllowed: conditionElement = "not-allowed"; break;
+ case ErrorPayload::NotAuthorized: conditionElement = "not-authorized"; break;
+ case ErrorPayload::PaymentRequired: conditionElement = "payment-required"; break;
+ case ErrorPayload::RecipientUnavailable: conditionElement = "recipient-unavailable"; break;
+ case ErrorPayload::Redirect: conditionElement = "redirect"; break;
+ case ErrorPayload::RegistrationRequired: conditionElement = "registration-required"; break;
+ case ErrorPayload::RemoteServerNotFound: conditionElement = "remote-server-not-found"; break;
+ case ErrorPayload::RemoteServerTimeout: conditionElement = "remote-server-timeout"; break;
+ case ErrorPayload::ResourceConstraint: conditionElement = "resource-constraint"; break;
+ case ErrorPayload::ServiceUnavailable: conditionElement = "service-unavailable"; break;
+ case ErrorPayload::SubscriptionRequired: conditionElement = "subscription-required"; break;
+ case ErrorPayload::UnexpectedRequest: conditionElement = "unexpected-request"; break;
default: conditionElement = "undefined-condition"; break;
}
result += "<" + conditionElement + " xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>";
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
index ecf73dc..931596f 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
@@ -2,14 +2,14 @@
#define SWIFTEN_ErrorSerializer_H
#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Error.h"
+#include "Swiften/Elements/ErrorPayload.h"
namespace Swift {
- class ErrorSerializer : public GenericPayloadSerializer<Error> {
+ class ErrorSerializer : public GenericPayloadSerializer<ErrorPayload> {
public:
ErrorSerializer();
- virtual String serializePayload(boost::shared_ptr<Error> error) const;
+ virtual String serializePayload(boost::shared_ptr<ErrorPayload> error) const;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
index 2d68a3d..ecd904a 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
@@ -16,7 +16,7 @@ class ErrorSerializerTest : public CppUnit::TestFixture
void testSerialize() {
ErrorSerializer testling;
- boost::shared_ptr<Error> error(new Error(Error::BadRequest, Error::Cancel, "My Error"));
+ boost::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error"));
CPPUNIT_ASSERT_EQUAL(String("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error));
}