summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-10 21:24:03 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-10 21:24:03 (GMT)
commit54781ce12f7654f8136e645d4ebc5934d90c6bea (patch)
tree90bad869f9f64d57a3c0af209b83a538a47c7762 /Swiften/Parser
parentfcfac59db5cb4503554f2b30854b2e91928296f6 (diff)
parent66ced3654ad295478b33d3e4f1716f66ab4048b5 (diff)
downloadswift-54781ce12f7654f8136e645d4ebc5934d90c6bea.zip
swift-54781ce12f7654f8136e645d4ebc5934d90c6bea.tar.bz2
Refactored session management.
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.cpp54
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.h4
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp6
3 files changed, 32 insertions, 32 deletions
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.cpp b/Swiften/Parser/PayloadParsers/ErrorParser.cpp
index 13380c8..ae85265 100644
--- a/Swiften/Parser/PayloadParsers/ErrorParser.cpp
+++ b/Swiften/Parser/PayloadParsers/ErrorParser.cpp
@@ -9,19 +9,19 @@ void ErrorParser::handleStartElement(const String&, const String&, const Attribu
if (level_ == TopLevel) {
String type = attributes.getAttribute("type");
if (type == "continue") {
- getPayloadInternal()->setType(Error::Continue);
+ getPayloadInternal()->setType(ErrorPayload::Continue);
}
else if (type == "modify") {
- getPayloadInternal()->setType(Error::Modify);
+ getPayloadInternal()->setType(ErrorPayload::Modify);
}
else if (type == "auth") {
- getPayloadInternal()->setType(Error::Auth);
+ getPayloadInternal()->setType(ErrorPayload::Auth);
}
else if (type == "wait") {
- getPayloadInternal()->setType(Error::Wait);
+ getPayloadInternal()->setType(ErrorPayload::Wait);
}
else {
- getPayloadInternal()->setType(Error::Cancel);
+ getPayloadInternal()->setType(ErrorPayload::Cancel);
}
}
++level_;
@@ -34,70 +34,70 @@ void ErrorParser::handleEndElement(const String& element, const String&) {
getPayloadInternal()->setText(currentText_);
}
else if (element == "bad-request") {
- getPayloadInternal()->setCondition(Error::BadRequest);
+ getPayloadInternal()->setCondition(ErrorPayload::BadRequest);
}
else if (element == "conflict") {
- getPayloadInternal()->setCondition(Error::Conflict);
+ getPayloadInternal()->setCondition(ErrorPayload::Conflict);
}
else if (element == "feature-not-implemented") {
- getPayloadInternal()->setCondition(Error::FeatureNotImplemented);
+ getPayloadInternal()->setCondition(ErrorPayload::FeatureNotImplemented);
}
else if (element == "forbidden") {
- getPayloadInternal()->setCondition(Error::Forbidden);
+ getPayloadInternal()->setCondition(ErrorPayload::Forbidden);
}
else if (element == "gone") {
- getPayloadInternal()->setCondition(Error::Gone);
+ getPayloadInternal()->setCondition(ErrorPayload::Gone);
}
else if (element == "internal-server-error") {
- getPayloadInternal()->setCondition(Error::InternalServerError);
+ getPayloadInternal()->setCondition(ErrorPayload::InternalServerError);
}
else if (element == "item-not-found") {
- getPayloadInternal()->setCondition(Error::ItemNotFound);
+ getPayloadInternal()->setCondition(ErrorPayload::ItemNotFound);
}
else if (element == "jid-malformed") {
- getPayloadInternal()->setCondition(Error::JIDMalformed);
+ getPayloadInternal()->setCondition(ErrorPayload::JIDMalformed);
}
else if (element == "not-acceptable") {
- getPayloadInternal()->setCondition(Error::NotAcceptable);
+ getPayloadInternal()->setCondition(ErrorPayload::NotAcceptable);
}
else if (element == "not-allowed") {
- getPayloadInternal()->setCondition(Error::NotAllowed);
+ getPayloadInternal()->setCondition(ErrorPayload::NotAllowed);
}
else if (element == "not-authorized") {
- getPayloadInternal()->setCondition(Error::NotAuthorized);
+ getPayloadInternal()->setCondition(ErrorPayload::NotAuthorized);
}
else if (element == "payment-required") {
- getPayloadInternal()->setCondition(Error::PaymentRequired);
+ getPayloadInternal()->setCondition(ErrorPayload::PaymentRequired);
}
else if (element == "recipient-unavailable") {
- getPayloadInternal()->setCondition(Error::RecipientUnavailable);
+ getPayloadInternal()->setCondition(ErrorPayload::RecipientUnavailable);
}
else if (element == "redirect") {
- getPayloadInternal()->setCondition(Error::Redirect);
+ getPayloadInternal()->setCondition(ErrorPayload::Redirect);
}
else if (element == "registration-required") {
- getPayloadInternal()->setCondition(Error::RegistrationRequired);
+ getPayloadInternal()->setCondition(ErrorPayload::RegistrationRequired);
}
else if (element == "remote-server-not-found") {
- getPayloadInternal()->setCondition(Error::RemoteServerNotFound);
+ getPayloadInternal()->setCondition(ErrorPayload::RemoteServerNotFound);
}
else if (element == "remote-server-timeout") {
- getPayloadInternal()->setCondition(Error::RemoteServerTimeout);
+ getPayloadInternal()->setCondition(ErrorPayload::RemoteServerTimeout);
}
else if (element == "resource-constraint") {
- getPayloadInternal()->setCondition(Error::ResourceConstraint);
+ getPayloadInternal()->setCondition(ErrorPayload::ResourceConstraint);
}
else if (element == "service-unavailable") {
- getPayloadInternal()->setCondition(Error::ServiceUnavailable);
+ getPayloadInternal()->setCondition(ErrorPayload::ServiceUnavailable);
}
else if (element == "subscription-required") {
- getPayloadInternal()->setCondition(Error::SubscriptionRequired);
+ getPayloadInternal()->setCondition(ErrorPayload::SubscriptionRequired);
}
else if (element == "unexpected-request") {
- getPayloadInternal()->setCondition(Error::UnexpectedRequest);
+ getPayloadInternal()->setCondition(ErrorPayload::UnexpectedRequest);
}
else {
- getPayloadInternal()->setCondition(Error::UndefinedCondition);
+ getPayloadInternal()->setCondition(ErrorPayload::UndefinedCondition);
}
}
}
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.h b/Swiften/Parser/PayloadParsers/ErrorParser.h
index 76db205..17b78b9 100644
--- a/Swiften/Parser/PayloadParsers/ErrorParser.h
+++ b/Swiften/Parser/PayloadParsers/ErrorParser.h
@@ -1,11 +1,11 @@
#ifndef SWIFTEN_ErrorParser_H
#define SWIFTEN_ErrorParser_H
-#include "Swiften/Elements/Error.h"
+#include "Swiften/Elements/ErrorPayload.h"
#include "Swiften/Parser/GenericPayloadParser.h"
namespace Swift {
- class ErrorParser : public GenericPayloadParser<Error> {
+ class ErrorParser : public GenericPayloadParser<ErrorPayload> {
public:
ErrorParser();
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
index 338fb3f..dcd3172 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
@@ -24,9 +24,9 @@ class ErrorParserTest : public CppUnit::TestFixture
"<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
"</error>"));
- Error* payload = dynamic_cast<Error*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(Error::BadRequest, payload->getCondition());
- CPPUNIT_ASSERT_EQUAL(Error::Modify, payload->getType());
+ ErrorPayload* payload = dynamic_cast<ErrorPayload*>(parser.getPayload().get());
+ CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition());
+ CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType());
CPPUNIT_ASSERT_EQUAL(String("boo"), payload->getText());
}
};