summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
m---------Swiften0
-rw-r--r--Swiften/Parser/PayloadParsers/BodyParser.cpp23
-rw-r--r--Swiften/Parser/PayloadParsers/BodyParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/BodyParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParser.cpp35
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParserFactory.h25
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp27
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.h25
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.cpp109
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp61
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h19
-rw-r--r--Swiften/Parser/PayloadParsers/PriorityParser.cpp25
-rw-r--r--Swiften/Parser/PayloadParsers/PriorityParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/PriorityParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp43
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParser.h25
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h26
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp26
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h20
-rw-r--r--Swiften/Parser/PayloadParsers/ResourceBindParser.cpp37
-rw-r--r--Swiften/Parser/PayloadParsers/ResourceBindParser.h24
-rw-r--r--Swiften/Parser/PayloadParsers/ResourceBindParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.h29
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp59
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.h31
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp55
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h32
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp32
-rw-r--r--Swiften/Parser/PayloadParsers/SoftwareVersionParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/SoftwareVersionParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/StartSessionParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/StartSessionParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/StatusParser.cpp23
-rw-r--r--Swiften/Parser/PayloadParsers/StatusParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/StatusParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/StatusShowParser.cpp37
-rw-r--r--Swiften/Parser/PayloadParsers/StatusShowParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/StatusShowParserFactory.h14
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.cpp49
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.h27
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParserFactory.h11
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp28
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp47
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h8
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h55
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp28
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp89
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp38
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp50
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp45
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp45
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp35
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp28
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp68
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp64
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp51
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp31
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.cpp53
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.h24
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParserFactory.h11
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp26
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParser.h25
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParserFactory.h11
74 files changed, 0 insertions, 2295 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Parser/PayloadParsers/BodyParser.cpp b/Swiften/Parser/PayloadParsers/BodyParser.cpp
deleted file mode 100644
index e5898ff..0000000
--- a/Swiften/Parser/PayloadParsers/BodyParser.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/BodyParser.h"
-
-namespace Swift {
-
-BodyParser::BodyParser() : level_(0) {
-}
-
-void BodyParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- ++level_;
-}
-
-void BodyParser::handleEndElement(const String&, const String&) {
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setText(text_);
- }
-}
-
-void BodyParser::handleCharacterData(const String& data) {
- text_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/BodyParser.h b/Swiften/Parser/PayloadParsers/BodyParser.h
deleted file mode 100644
index 2d272ea..0000000
--- a/Swiften/Parser/PayloadParsers/BodyParser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef SWIFTEN_BodyParser_H
-#define SWIFTEN_BodyParser_H
-
-#include "Swiften/Elements/Body.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class BodyParser : public GenericPayloadParser<Body> {
- public:
- BodyParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- String text_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/BodyParserFactory.h b/Swiften/Parser/PayloadParsers/BodyParserFactory.h
deleted file mode 100644
index 3da7393..0000000
--- a/Swiften/Parser/PayloadParsers/BodyParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_BodyParserFACTORY_H
-#define SWIFTEN_BodyParserFACTORY_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/BodyParser.h"
-
-namespace Swift {
- class BodyParserFactory : public GenericPayloadParserFactory<BodyParser> {
- public:
- BodyParserFactory() : GenericPayloadParserFactory<BodyParser>("body") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp b/Swiften/Parser/PayloadParsers/ChatStateParser.cpp
deleted file mode 100644
index 52d860a..0000000
--- a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/ChatStateParser.h"
-
-namespace Swift {
-
-ChatStateParser::ChatStateParser() : level_(0) {
-}
-
-void ChatStateParser::handleStartElement(const String& element, const String&, const AttributeMap&) {
- if (level_ == 0) {
- ChatState::ChatStateType state = ChatState::Active;
- if (element == "active") {
- state = ChatState::Active;
- } else if (element == "composing") {
- state = ChatState::Composing;
- } else if (element == "inactive") {
- state = ChatState::Inactive;
- } else if (element == "paused") {
- state = ChatState::Paused;
- } else if (element == "gone") {
- state = ChatState::Gone;
- }
- getPayloadInternal()->setChatState(state);
- }
- ++level_;
-}
-
-void ChatStateParser::handleEndElement(const String&, const String&) {
- --level_;
-}
-
-void ChatStateParser::handleCharacterData(const String&) {
-
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.h b/Swiften/Parser/PayloadParsers/ChatStateParser.h
deleted file mode 100644
index cd212c0..0000000
--- a/Swiften/Parser/PayloadParsers/ChatStateParser.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-#include "Swiften/Elements/ChatState.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class ChatStateParser : public GenericPayloadParser<ChatState> {
- public:
- ChatStateParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
deleted file mode 100644
index 1582d09..0000000
--- a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/PayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ChatStateParser.h"
-
-namespace Swift {
- class PayloadParserFactoryCollection;
-
- class ChatStateParserFactory : public PayloadParserFactory {
- public:
- ChatStateParserFactory() {
- }
-
- virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const {
- return ns == "http://jabber.org/protocol/chatstates" &&
- (element == "active" || element == "composing"
- || element == "paused" || element == "inactive" || element == "gone");
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new ChatStateParser();
- }
-
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
deleted file mode 100644
index ffa24ad..0000000
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h"
-
-namespace Swift {
-
-DiscoInfoParser::DiscoInfoParser() : level_(TopLevel) {
-}
-
-void DiscoInfoParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "identity") {
- getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang")));
- }
- else if (element == "feature") {
- getPayloadInternal()->addFeature(attributes.getAttribute("var"));
- }
- }
- ++level_;
-}
-
-void DiscoInfoParser::handleEndElement(const String&, const String&) {
- --level_;
-}
-
-void DiscoInfoParser::handleCharacterData(const String&) {
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
deleted file mode 100644
index b7be972..0000000
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef SWIFTEN_DiscoInfoParser_H
-#define SWIFTEN_DiscoInfoParser_H
-
-#include "Swiften/Elements/DiscoInfo.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
- public:
- DiscoInfoParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParserFactory.h b/Swiften/Parser/PayloadParsers/DiscoInfoParserFactory.h
deleted file mode 100644
index ef1c31c..0000000
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_DiscoInfoParserFactory_H
-#define SWIFTEN_DiscoInfoParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h"
-
-namespace Swift {
- class DiscoInfoParserFactory : public GenericPayloadParserFactory<DiscoInfoParser> {
- public:
- DiscoInfoParserFactory() : GenericPayloadParserFactory<DiscoInfoParser>("query", "http://jabber.org/protocol/disco#info") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.cpp b/Swiften/Parser/PayloadParsers/ErrorParser.cpp
deleted file mode 100644
index ae85265..0000000
--- a/Swiften/Parser/PayloadParsers/ErrorParser.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/ErrorParser.h"
-
-namespace Swift {
-
-ErrorParser::ErrorParser() : level_(TopLevel) {
-}
-
-void ErrorParser::handleStartElement(const String&, const String&, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- String type = attributes.getAttribute("type");
- if (type == "continue") {
- getPayloadInternal()->setType(ErrorPayload::Continue);
- }
- else if (type == "modify") {
- getPayloadInternal()->setType(ErrorPayload::Modify);
- }
- else if (type == "auth") {
- getPayloadInternal()->setType(ErrorPayload::Auth);
- }
- else if (type == "wait") {
- getPayloadInternal()->setType(ErrorPayload::Wait);
- }
- else {
- getPayloadInternal()->setType(ErrorPayload::Cancel);
- }
- }
- ++level_;
-}
-
-void ErrorParser::handleEndElement(const String& element, const String&) {
- --level_;
- if (level_ == PayloadLevel) {
- if (element == "text") {
- getPayloadInternal()->setText(currentText_);
- }
- else if (element == "bad-request") {
- getPayloadInternal()->setCondition(ErrorPayload::BadRequest);
- }
- else if (element == "conflict") {
- getPayloadInternal()->setCondition(ErrorPayload::Conflict);
- }
- else if (element == "feature-not-implemented") {
- getPayloadInternal()->setCondition(ErrorPayload::FeatureNotImplemented);
- }
- else if (element == "forbidden") {
- getPayloadInternal()->setCondition(ErrorPayload::Forbidden);
- }
- else if (element == "gone") {
- getPayloadInternal()->setCondition(ErrorPayload::Gone);
- }
- else if (element == "internal-server-error") {
- getPayloadInternal()->setCondition(ErrorPayload::InternalServerError);
- }
- else if (element == "item-not-found") {
- getPayloadInternal()->setCondition(ErrorPayload::ItemNotFound);
- }
- else if (element == "jid-malformed") {
- getPayloadInternal()->setCondition(ErrorPayload::JIDMalformed);
- }
- else if (element == "not-acceptable") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAcceptable);
- }
- else if (element == "not-allowed") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAllowed);
- }
- else if (element == "not-authorized") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAuthorized);
- }
- else if (element == "payment-required") {
- getPayloadInternal()->setCondition(ErrorPayload::PaymentRequired);
- }
- else if (element == "recipient-unavailable") {
- getPayloadInternal()->setCondition(ErrorPayload::RecipientUnavailable);
- }
- else if (element == "redirect") {
- getPayloadInternal()->setCondition(ErrorPayload::Redirect);
- }
- else if (element == "registration-required") {
- getPayloadInternal()->setCondition(ErrorPayload::RegistrationRequired);
- }
- else if (element == "remote-server-not-found") {
- getPayloadInternal()->setCondition(ErrorPayload::RemoteServerNotFound);
- }
- else if (element == "remote-server-timeout") {
- getPayloadInternal()->setCondition(ErrorPayload::RemoteServerTimeout);
- }
- else if (element == "resource-constraint") {
- getPayloadInternal()->setCondition(ErrorPayload::ResourceConstraint);
- }
- else if (element == "service-unavailable") {
- getPayloadInternal()->setCondition(ErrorPayload::ServiceUnavailable);
- }
- else if (element == "subscription-required") {
- getPayloadInternal()->setCondition(ErrorPayload::SubscriptionRequired);
- }
- else if (element == "unexpected-request") {
- getPayloadInternal()->setCondition(ErrorPayload::UnexpectedRequest);
- }
- else {
- getPayloadInternal()->setCondition(ErrorPayload::UndefinedCondition);
- }
- }
-}
-
-void ErrorParser::handleCharacterData(const String& data) {
- currentText_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.h b/Swiften/Parser/PayloadParsers/ErrorParser.h
deleted file mode 100644
index 17b78b9..0000000
--- a/Swiften/Parser/PayloadParsers/ErrorParser.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef SWIFTEN_ErrorParser_H
-#define SWIFTEN_ErrorParser_H
-
-#include "Swiften/Elements/ErrorPayload.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class ErrorParser : public GenericPayloadParser<ErrorPayload> {
- public:
- ErrorParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- String currentText_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/ErrorParserFactory.h b/Swiften/Parser/PayloadParsers/ErrorParserFactory.h
deleted file mode 100644
index 36d1f55..0000000
--- a/Swiften/Parser/PayloadParsers/ErrorParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_ErrorParserFactory_H
-#define SWIFTEN_ErrorParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ErrorParser.h"
-
-namespace Swift {
- class ErrorParserFactory : public GenericPayloadParserFactory<ErrorParser> {
- public:
- ErrorParserFactory() : GenericPayloadParserFactory<ErrorParser>("error") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
deleted file mode 100644
index 0857f64..0000000
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-#include "Swiften/Parser/PayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ErrorParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/BodyParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ChatStateParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/PriorityParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ResourceBindParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StartSessionParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StatusParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StatusShowParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/RosterParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SoftwareVersionParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StorageParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/DiscoInfoParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/VCardUpdateParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/VCardParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h"
-
-using namespace boost;
-
-namespace Swift {
-
-FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
- factories_.push_back(shared_ptr<PayloadParserFactory>(new StatusParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new StatusShowParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new BodyParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new PriorityParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new ErrorParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new SoftwareVersionParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new StorageParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new RosterParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new DiscoInfoParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new ResourceBindParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new StartSessionParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new SecurityLabelParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new SecurityLabelsCatalogParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new VCardUpdateParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new VCardParserFactory()));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new PrivateStorageParserFactory(this)));
- factories_.push_back(shared_ptr<PayloadParserFactory>(new ChatStateParserFactory()));
- foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
- addFactory(factory.get());
- }
- defaultFactory_ = new RawXMLPayloadParserFactory();
- setDefaultFactory(defaultFactory_);
-}
-
-FullPayloadParserFactoryCollection::~FullPayloadParserFactoryCollection() {
- setDefaultFactory(NULL);
- delete defaultFactory_;
- foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
- removeFactory(factory.get());
- }
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
deleted file mode 100644
index 82e5a56..0000000
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-#include "Swiften/Parser/PayloadParserFactoryCollection.h"
-#include "Swiften/Parser/PayloadParserFactory.h"
-
-namespace Swift {
- class FullPayloadParserFactoryCollection : public PayloadParserFactoryCollection {
- public:
- FullPayloadParserFactoryCollection();
- ~FullPayloadParserFactoryCollection();
-
- private:
- std::vector< boost::shared_ptr<PayloadParserFactory> > factories_;
- PayloadParserFactory* defaultFactory_;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.cpp b/Swiften/Parser/PayloadParsers/PriorityParser.cpp
deleted file mode 100644
index 3dcca51..0000000
--- a/Swiften/Parser/PayloadParsers/PriorityParser.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/PriorityParser.h"
-
-#include <boost/lexical_cast.hpp>
-
-namespace Swift {
-
-PriorityParser::PriorityParser() : level_(0) {
-}
-
-void PriorityParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- ++level_;
-}
-
-void PriorityParser::handleEndElement(const String&, const String&) {
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setPriority(boost::lexical_cast<int>(text_));
- }
-}
-
-void PriorityParser::handleCharacterData(const String& data) {
- text_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.h b/Swiften/Parser/PayloadParsers/PriorityParser.h
deleted file mode 100644
index 7f3836f..0000000
--- a/Swiften/Parser/PayloadParsers/PriorityParser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef SWIFTEN_PriorityParser_H
-#define SWIFTEN_PriorityParser_H
-
-#include "Swiften/Elements/Priority.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class PriorityParser : public GenericPayloadParser<Priority> {
- public:
- PriorityParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- String text_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/PriorityParserFactory.h b/Swiften/Parser/PayloadParsers/PriorityParserFactory.h
deleted file mode 100644
index 5386326..0000000
--- a/Swiften/Parser/PayloadParsers/PriorityParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_PriorityParserFactory_H
-#define SWIFTEN_PriorityParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/PriorityParser.h"
-
-namespace Swift {
- class PriorityParserFactory : public GenericPayloadParserFactory<PriorityParser> {
- public:
- PriorityParserFactory() : GenericPayloadParserFactory<PriorityParser>("priority") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp b/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp
deleted file mode 100644
index 5c3af26..0000000
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/PrivateStorageParser.h"
-#include "Swiften/Parser/PayloadParserFactoryCollection.h"
-#include "Swiften/Parser/PayloadParserFactory.h"
-
-namespace Swift {
-
-PrivateStorageParser::PrivateStorageParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) {
-}
-
-void PrivateStorageParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser.get()) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
-}
-
-void PrivateStorageParser::handleEndElement(const String& element, const String& ns) {
- --level;
- if (currentPayloadParser.get()) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
- }
- }
-}
-
-void PrivateStorageParser::handleCharacterData(const String& data) {
- if (level > 1 && currentPayloadParser.get()) {
- currentPayloadParser->handleCharacterData(data);
- }
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h
deleted file mode 100644
index fae0f10..0000000
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include <boost/optional.hpp>
-
-#include "Swiften/Elements/PrivateStorage.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class PayloadParserFactoryCollection;
-
- class PrivateStorageParser : public GenericPayloadParser<PrivateStorage> {
- public:
- PrivateStorageParser(PayloadParserFactoryCollection* factories);
-
- private:
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- std::auto_ptr<PayloadParser> currentPayloadParser;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h b/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h
deleted file mode 100644
index 4d9c02b..0000000
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/PayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/PrivateStorageParser.h"
-
-namespace Swift {
- class PayloadParserFactoryCollection;
-
- class PrivateStorageParserFactory : public PayloadParserFactory {
- public:
- PrivateStorageParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
-
- virtual bool canParse(const String& element, const String& ns, const AttributeMap&) const {
- return element == "query" && ns == "jabber:iq:private";
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new PrivateStorageParser(factories);
- }
-
- private:
- PayloadParserFactoryCollection* factories;
-
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp
deleted file mode 100644
index c49af3e..0000000
--- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h"
-#include "Swiften/Parser/SerializingParser.h"
-
-namespace Swift {
-
-RawXMLPayloadParser::RawXMLPayloadParser() : level_(0) {
-}
-
-void RawXMLPayloadParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- ++level_;
- serializingParser_.handleStartElement(element, ns, attributes);
-}
-
-void RawXMLPayloadParser::handleEndElement(const String& element, const String& ns) {
- serializingParser_.handleEndElement(element, ns);
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setRawXML(serializingParser_.getResult());
- }
-}
-
-void RawXMLPayloadParser::handleCharacterData(const String& data) {
- serializingParser_.handleCharacterData(data);
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h
deleted file mode 100644
index f636486..0000000
--- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include "Swiften/Elements/RawXMLPayload.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-#include "Swiften/Parser/SerializingParser.h"
-
-namespace Swift {
- class SerializingParser;
-
- class RawXMLPayloadParser : public GenericPayloadParser<RawXMLPayload> {
- public:
- RawXMLPayloadParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- SerializingParser serializingParser_;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h
deleted file mode 100644
index 46b1183..0000000
--- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/PayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h"
-#include "Swiften/Base/String.h"
-
-namespace Swift {
- class RawXMLPayloadParserFactory : public PayloadParserFactory {
- public:
- RawXMLPayloadParserFactory() {}
-
- virtual bool canParse(const String&, const String&, const AttributeMap&) const {
- return true;
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new RawXMLPayloadParser();
- }
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp b/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp
deleted file mode 100644
index c5ca787..0000000
--- a/Swiften/Parser/PayloadParsers/ResourceBindParser.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/ResourceBindParser.h"
-
-namespace Swift {
-
-ResourceBindParser::ResourceBindParser() : level_(0), inJID_(false), inResource_(false) {
-}
-
-void ResourceBindParser::handleStartElement(const String& element, const String&, const AttributeMap&) {
- if (level_ == 1) {
- text_ = "";
- if (element == "resource") {
- inResource_ = true;
- }
- if (element == "jid") {
- inJID_ = true;
- }
- }
- ++level_;
-}
-
-void ResourceBindParser::handleEndElement(const String&, const String&) {
- --level_;
- if (level_ == 1) {
- if (inJID_) {
- getPayloadInternal()->setJID(JID(text_));
- }
- else if (inResource_) {
- getPayloadInternal()->setResource(text_);
- }
- }
-}
-
-void ResourceBindParser::handleCharacterData(const String& data) {
- text_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/ResourceBindParser.h b/Swiften/Parser/PayloadParsers/ResourceBindParser.h
deleted file mode 100644
index 1341140..0000000
--- a/Swiften/Parser/PayloadParsers/ResourceBindParser.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef SWIFTEN_ResourceBindParser_H
-#define SWIFTEN_ResourceBindParser_H
-
-#include "Swiften/Elements/ResourceBind.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class ResourceBindParser : public GenericPayloadParser<ResourceBind> {
- public:
- ResourceBindParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- bool inJID_;
- bool inResource_;
- String text_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/ResourceBindParserFactory.h b/Swiften/Parser/PayloadParsers/ResourceBindParserFactory.h
deleted file mode 100644
index 54af9c9..0000000
--- a/Swiften/Parser/PayloadParsers/ResourceBindParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_ResourceBindParserFactory_H
-#define SWIFTEN_ResourceBindParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/ResourceBindParser.h"
-
-namespace Swift {
- class ResourceBindParserFactory : public GenericPayloadParserFactory<ResourceBindParser> {
- public:
- ResourceBindParserFactory() : GenericPayloadParserFactory<ResourceBindParser>("bind", "urn:ietf:params:xml:ns:xmpp-bind") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/RosterParser.cpp b/Swiften/Parser/PayloadParsers/RosterParser.cpp
deleted file mode 100644
index 0c4e99b..0000000
--- a/Swiften/Parser/PayloadParsers/RosterParser.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/RosterParser.h"
-
-namespace Swift {
-
-RosterParser::RosterParser() : level_(TopLevel) {
-}
-
-void RosterParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "item") {
- inItem_ = true;
- currentItem_ = RosterItemPayload();
-
- currentItem_.setJID(JID(attributes.getAttribute("jid")));
- currentItem_.setName(attributes.getAttribute("name"));
-
- String subscription = attributes.getAttribute("subscription");
- if (subscription == "both") {
- currentItem_.setSubscription(RosterItemPayload::Both);
- }
- else if (subscription == "to") {
- currentItem_.setSubscription(RosterItemPayload::To);
- }
- else if (subscription == "from") {
- currentItem_.setSubscription(RosterItemPayload::From);
- }
- else if (subscription == "remove") {
- currentItem_.setSubscription(RosterItemPayload::Remove);
- }
- else {
- currentItem_.setSubscription(RosterItemPayload::None);
- }
-
- if (attributes.getAttribute("ask") == "subscribe") {
- currentItem_.setSubscriptionRequested();
- }
- }
- }
- else if (level_ == ItemLevel) {
- if (element == "group") {
- currentText_ = "";
- }
- }
- ++level_;
-}
-
-void RosterParser::handleEndElement(const String& element, const String&) {
- --level_;
- if (level_ == PayloadLevel) {
- if (inItem_) {
- getPayloadInternal()->addItem(currentItem_);
- inItem_ = false;
- }
- }
- else if (level_ == ItemLevel) {
- if (element == "group") {
- currentItem_.addGroup(currentText_);
- }
- }
-}
-
-void RosterParser::handleCharacterData(const String& data) {
- currentText_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/RosterParser.h b/Swiften/Parser/PayloadParsers/RosterParser.h
deleted file mode 100644
index bd8186a..0000000
--- a/Swiften/Parser/PayloadParsers/RosterParser.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef SWIFTEN_RosterParser_H
-#define SWIFTEN_RosterParser_H
-
-#include "Swiften/Elements/RosterPayload.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class RosterParser : public GenericPayloadParser<RosterPayload> {
- public:
- RosterParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1,
- ItemLevel = 2
- };
- int level_;
- bool inItem_;
- RosterItemPayload currentItem_;
- String currentText_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/RosterParserFactory.h b/Swiften/Parser/PayloadParsers/RosterParserFactory.h
deleted file mode 100644
index f51b3ab..0000000
--- a/Swiften/Parser/PayloadParsers/RosterParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_RosterParserFactory_H
-#define SWIFTEN_RosterParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/RosterParser.h"
-
-namespace Swift {
- class RosterParserFactory : public GenericPayloadParserFactory<RosterParser> {
- public:
- RosterParserFactory() : GenericPayloadParserFactory<RosterParser>("query", "jabber:iq:roster") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp
deleted file mode 100644
index 7e65575..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParser.h"
-#include "Swiften/Parser/SerializingParser.h"
-
-namespace Swift {
-
-SecurityLabelParser::SecurityLabelParser() : level_(TopLevel), labelParser_(0) {
-}
-
-void SecurityLabelParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- ++level_;
- if (level_ == DisplayMarkingOrLabelLevel) {
- if (element == "displaymarking") {
- currentText_ = "";
- getPayloadInternal()->setBackgroundColor(attributes.getAttribute("bgcolor"));
- getPayloadInternal()->setForegroundColor(attributes.getAttribute("fgcolor"));
- }
- else if (element == "label" || element == "equivalentlabel") {
- assert(!labelParser_);
- labelParser_ = new SerializingParser();
- }
- }
- else if (level_ >= SecurityLabelLevel && labelParser_) {
- labelParser_->handleStartElement(element, ns, attributes);
- }
-}
-
-void SecurityLabelParser::handleEndElement(const String& element, const String& ns) {
- if (level_ == DisplayMarkingOrLabelLevel) {
- if (element == "displaymarking") {
- getPayloadInternal()->setDisplayMarking(currentText_);
- }
- else if (labelParser_) {
- if (element == "label") {
- getPayloadInternal()->setLabel(labelParser_->getResult());
- }
- else {
- getPayloadInternal()->addEquivalentLabel(labelParser_->getResult());
- }
- delete labelParser_;
- labelParser_ = 0;
- }
- }
- else if (labelParser_ && level_ >= SecurityLabelLevel) {
- labelParser_->handleEndElement(element, ns);
- }
- --level_;
-
-}
-
-void SecurityLabelParser::handleCharacterData(const String& data) {
- if (labelParser_) {
- labelParser_->handleCharacterData(data);
- }
- else {
- currentText_ += data;
- }
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h
deleted file mode 100644
index 70040d9..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef SWIFTEN_SecurityLabelParser_H
-#define SWIFTEN_SecurityLabelParser_H
-
-#include "Swiften/Elements/SecurityLabel.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class SerializingParser;
-
- class SecurityLabelParser : public GenericPayloadParser<SecurityLabel> {
- public:
- SecurityLabelParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1,
- DisplayMarkingOrLabelLevel = 2,
- SecurityLabelLevel = 3
- };
- int level_;
- SerializingParser* labelParser_;
- String currentText_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h b/Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h
deleted file mode 100644
index 0341fbb..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_SecurityLabelParserFactory_H
-#define SWIFTEN_SecurityLabelParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParser.h"
-
-namespace Swift {
- class SecurityLabelParserFactory : public GenericPayloadParserFactory<SecurityLabelParser> {
- public:
- SecurityLabelParserFactory() : GenericPayloadParserFactory<SecurityLabelParser>("securitylabel", "urn:xmpp:sec-label:0") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
deleted file mode 100644
index e4da756..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParser.h"
-
-namespace Swift {
-
-SecurityLabelsCatalogParser::SecurityLabelsCatalogParser() : level_(TopLevel), labelParser_(0) {
- labelParserFactory_ = new SecurityLabelParserFactory();
-}
-
-SecurityLabelsCatalogParser::~SecurityLabelsCatalogParser() {
- delete labelParserFactory_;
-}
-
-void SecurityLabelsCatalogParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- ++level_;
- if (level_ == PayloadLevel) {
- getPayloadInternal()->setTo(JID(attributes.getAttribute("to")));
- getPayloadInternal()->setName(attributes.getAttribute("name"));
- getPayloadInternal()->setDescription(attributes.getAttribute("desc"));
- }
- else if (level_ == LabelLevel) {
- assert(!labelParser_);
- if (labelParserFactory_->canParse(element, ns, attributes)) {
- labelParser_ = dynamic_cast<SecurityLabelParser*>(labelParserFactory_->createPayloadParser());
- assert(labelParser_);
- }
- }
-
- if (labelParser_) {
- labelParser_->handleStartElement(element, ns, attributes);
- }
-}
-
-void SecurityLabelsCatalogParser::handleEndElement(const String& element, const String& ns) {
- if (labelParser_) {
- labelParser_->handleEndElement(element, ns);
- }
- if (level_ == LabelLevel && labelParser_) {
- SecurityLabel* label = dynamic_cast<SecurityLabel*>(labelParser_->getPayload().get());
- assert(label);
- getPayloadInternal()->addLabel(SecurityLabel(*label));
- delete labelParser_;
- labelParser_ = 0;
- }
- --level_;
-}
-
-void SecurityLabelsCatalogParser::handleCharacterData(const String& data) {
- if (labelParser_) {
- labelParser_->handleCharacterData(data);
- }
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h
deleted file mode 100644
index 799e43a..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef SWIFTEN_SecurityLabelsCatalogParser_H
-#define SWIFTEN_SecurityLabelsCatalogParser_H
-
-#include "Swiften/Elements/SecurityLabelsCatalog.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class SecurityLabelParserFactory;
- class SecurityLabelParser;
-
- class SecurityLabelsCatalogParser : public GenericPayloadParser<SecurityLabelsCatalog> {
- public:
- SecurityLabelsCatalogParser();
- ~SecurityLabelsCatalogParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1,
- LabelLevel = 2
- };
- int level_;
- SecurityLabelParserFactory* labelParserFactory_;
- SecurityLabelParser* labelParser_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParserFactory.h b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParserFactory.h
deleted file mode 100644
index 99a310b..0000000
--- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_SecurityLabelsCatalogParserFactory_H
-#define SWIFTEN_SecurityLabelsCatalogParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h"
-
-namespace Swift {
- class SecurityLabelsCatalogParserFactory : public GenericPayloadParserFactory<SecurityLabelsCatalogParser> {
- public:
- SecurityLabelsCatalogParserFactory() : GenericPayloadParserFactory<SecurityLabelsCatalogParser>("catalog", "urn:xmpp:sec-label:catalog:0") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp
deleted file mode 100644
index dae9f94..0000000
--- a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/SoftwareVersionParser.h"
-
-namespace Swift {
-
-SoftwareVersionParser::SoftwareVersionParser() : level_(TopLevel) {
-}
-
-void SoftwareVersionParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- ++level_;
-}
-
-void SoftwareVersionParser::handleEndElement(const String& element, const String&) {
- --level_;
- if (level_ == PayloadLevel) {
- if (element == "name") {
- getPayloadInternal()->setName(currentText_);
- }
- else if (element == "version") {
- getPayloadInternal()->setVersion(currentText_);
- }
- else if (element == "os") {
- getPayloadInternal()->setOS(currentText_);
- }
- currentText_ = "";
- }
-}
-
-void SoftwareVersionParser::handleCharacterData(const String& data) {
- currentText_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h b/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h
deleted file mode 100644
index bfffc90..0000000
--- a/Swiften/Parser/PayloadParsers/SoftwareVersionParser.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef SWIFTEN_SoftwareVersionParser_H
-#define SWIFTEN_SoftwareVersionParser_H
-
-#include "Swiften/Elements/SoftwareVersion.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class SoftwareVersionParser : public GenericPayloadParser<SoftwareVersion> {
- public:
- SoftwareVersionParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- String currentText_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/SoftwareVersionParserFactory.h b/Swiften/Parser/PayloadParsers/SoftwareVersionParserFactory.h
deleted file mode 100644
index cb33e0b..0000000
--- a/Swiften/Parser/PayloadParsers/SoftwareVersionParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_SoftwareVersionParserFactory_H
-#define SWIFTEN_SoftwareVersionParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/SoftwareVersionParser.h"
-
-namespace Swift {
- class SoftwareVersionParserFactory : public GenericPayloadParserFactory<SoftwareVersionParser> {
- public:
- SoftwareVersionParserFactory() : GenericPayloadParserFactory<SoftwareVersionParser>("query", "jabber:iq:version") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StartSessionParser.h b/Swiften/Parser/PayloadParsers/StartSessionParser.h
deleted file mode 100644
index 059d036..0000000
--- a/Swiften/Parser/PayloadParsers/StartSessionParser.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef SWIFTEN_StartSessionParser_H
-#define SWIFTEN_StartSessionParser_H
-
-#include "Swiften/Elements/StartSession.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class StartSessionParser : public GenericPayloadParser<StartSession> {
- public:
- StartSessionParser() {}
-
- virtual void handleStartElement(const String&, const String&, const AttributeMap&) {}
- virtual void handleEndElement(const String&, const String&) {}
- virtual void handleCharacterData(const String&) {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StartSessionParserFactory.h b/Swiften/Parser/PayloadParsers/StartSessionParserFactory.h
deleted file mode 100644
index 5eed749..0000000
--- a/Swiften/Parser/PayloadParsers/StartSessionParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_StartSessionParserFactory_H
-#define SWIFTEN_StartSessionParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StartSessionParser.h"
-
-namespace Swift {
- class StartSessionParserFactory : public GenericPayloadParserFactory<StartSessionParser> {
- public:
- StartSessionParserFactory() : GenericPayloadParserFactory<StartSessionParser>("session", "urn:ietf:params:xml:ns:xmpp-session") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StatusParser.cpp b/Swiften/Parser/PayloadParsers/StatusParser.cpp
deleted file mode 100644
index c7771b9..0000000
--- a/Swiften/Parser/PayloadParsers/StatusParser.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/StatusParser.h"
-
-namespace Swift {
-
-StatusParser::StatusParser() : level_(0) {
-}
-
-void StatusParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- ++level_;
-}
-
-void StatusParser::handleEndElement(const String&, const String&) {
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setText(text_);
- }
-}
-
-void StatusParser::handleCharacterData(const String& data) {
- text_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/StatusParser.h b/Swiften/Parser/PayloadParsers/StatusParser.h
deleted file mode 100644
index 36ae094..0000000
--- a/Swiften/Parser/PayloadParsers/StatusParser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef SWIFTEN_StatusParser_H
-#define SWIFTEN_StatusParser_H
-
-#include "Swiften/Elements/Status.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class StatusParser : public GenericPayloadParser<Status> {
- public:
- StatusParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- String text_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StatusParserFactory.h b/Swiften/Parser/PayloadParsers/StatusParserFactory.h
deleted file mode 100644
index 72af5a9..0000000
--- a/Swiften/Parser/PayloadParsers/StatusParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_StatusParserFactory_H
-#define SWIFTEN_StatusParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StatusParser.h"
-
-namespace Swift {
- class StatusParserFactory : public GenericPayloadParserFactory<StatusParser> {
- public:
- StatusParserFactory() : GenericPayloadParserFactory<StatusParser>("status") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StatusShowParser.cpp b/Swiften/Parser/PayloadParsers/StatusShowParser.cpp
deleted file mode 100644
index c3719af..0000000
--- a/Swiften/Parser/PayloadParsers/StatusShowParser.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/StatusShowParser.h"
-
-namespace Swift {
-
-StatusShowParser::StatusShowParser() : level_(0) {
-}
-
-void StatusShowParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- ++level_;
-}
-
-void StatusShowParser::handleEndElement(const String&, const String&) {
- --level_;
- if (level_ == 0) {
- if (text_ == "away") {
- getPayloadInternal()->setType(StatusShow::Away);
- }
- else if (text_ == "chat") {
- getPayloadInternal()->setType(StatusShow::FFC);
- }
- else if (text_ == "xa") {
- getPayloadInternal()->setType(StatusShow::XA);
- }
- else if (text_ == "dnd") {
- getPayloadInternal()->setType(StatusShow::DND);
- }
- else {
- getPayloadInternal()->setType(StatusShow::Online);
- }
- }
-}
-
-void StatusShowParser::handleCharacterData(const String& data) {
- text_ += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/StatusShowParser.h b/Swiften/Parser/PayloadParsers/StatusShowParser.h
deleted file mode 100644
index a8ddb09..0000000
--- a/Swiften/Parser/PayloadParsers/StatusShowParser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef SWIFTEN_StatusShowParser_H
-#define SWIFTEN_StatusShowParser_H
-
-#include "Swiften/Elements/StatusShow.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class StatusShowParser : public GenericPayloadParser<StatusShow> {
- public:
- StatusShowParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- int level_;
- String text_;
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StatusShowParserFactory.h b/Swiften/Parser/PayloadParsers/StatusShowParserFactory.h
deleted file mode 100644
index 2ddc190..0000000
--- a/Swiften/Parser/PayloadParsers/StatusShowParserFactory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SWIFTEN_StatusShowParserFactory_H
-#define SWIFTEN_StatusShowParserFactory_H
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StatusShowParser.h"
-
-namespace Swift {
- class StatusShowParserFactory : public GenericPayloadParserFactory<StatusShowParser> {
- public:
- StatusShowParserFactory() : GenericPayloadParserFactory<StatusShowParser>("show") {}
- };
-}
-
-#endif
diff --git a/Swiften/Parser/PayloadParsers/StorageParser.cpp b/Swiften/Parser/PayloadParsers/StorageParser.cpp
deleted file mode 100644
index 3eab15e..0000000
--- a/Swiften/Parser/PayloadParsers/StorageParser.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/StorageParser.h"
-
-#include <cassert>
-
-namespace Swift {
-
-StorageParser::StorageParser() : level(TopLevel) {
-}
-
-void StorageParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) {
- if (level == BookmarkLevel) {
- if (element == "conference") {
- assert(!conference);
- conference = Storage::Conference();
- conference->autoJoin = attributes.getBoolAttribute("autojoin", false);
- conference->jid = JID(attributes.getAttribute("jid"));
- conference->name = attributes.getAttribute("name");
- }
- }
- else if (level == DetailLevel) {
- currentText = "";
- }
- ++level;
-}
-
-void StorageParser::handleEndElement(const String& element, const String&) {
- --level;
- if (level == BookmarkLevel) {
- if (element == "conference") {
- assert(conference);
- getPayloadInternal()->addConference(*conference);
- conference.reset();
- }
- }
- else if (level == DetailLevel && conference) {
- if (element == "nick") {
- conference->nick = currentText;
- }
- else if (element == "password") {
- conference->password = currentText;
- }
- }
-}
-
-void StorageParser::handleCharacterData(const String& data) {
- currentText += data;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/StorageParser.h b/Swiften/Parser/PayloadParsers/StorageParser.h
deleted file mode 100644
index ad0ab4d..0000000
--- a/Swiften/Parser/PayloadParsers/StorageParser.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include <boost/optional.hpp>
-
-#include "Swiften/Elements/Storage.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class StorageParser : public GenericPayloadParser<Storage> {
- public:
- StorageParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- BookmarkLevel = 1,
- DetailLevel = 2
- };
- int level;
- String currentText;
- boost::optional<Storage::Conference> conference;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/StorageParserFactory.h b/Swiften/Parser/PayloadParsers/StorageParserFactory.h
deleted file mode 100644
index 147d178..0000000
--- a/Swiften/Parser/PayloadParsers/StorageParserFactory.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/StorageParser.h"
-
-namespace Swift {
- class StorageParserFactory : public GenericPayloadParserFactory<StorageParser> {
- public:
- StorageParserFactory() : GenericPayloadParserFactory<StorageParser>("storage", "storage:bookmarks") {}
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp
deleted file mode 100644
index 2fc6180..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/BodyParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class BodyParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(BodyParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- BodyParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<body>foo<baz>bar</baz>fum</body>"));
-
- Body* payload = dynamic_cast<Body*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("foobarfum"), payload->getText());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(BodyParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
deleted file mode 100644
index 49b706e..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class DiscoInfoParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(DiscoInfoParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- DiscoInfoParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<query xmlns=\"http://jabber.org/protocol/disco#info\">"
- "<identity name=\"Swift\" category=\"client\" type=\"pc\" xml:lang=\"en\"/>"
- "<identity name=\"Vlug\" category=\"client\" type=\"pc\" xml:lang=\"nl\"/>"
- "<feature var=\"foo-feature\"/>"
- "<feature var=\"bar-feature\"/>"
- "<feature var=\"baz-feature\"/>"
- "</query>"));
-
- DiscoInfo* payload = dynamic_cast<DiscoInfo*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size()));
- CPPUNIT_ASSERT_EQUAL(String("Swift"), payload->getIdentities()[0].getName());
- CPPUNIT_ASSERT_EQUAL(String("pc"), payload->getIdentities()[0].getType());
- CPPUNIT_ASSERT_EQUAL(String("client"), payload->getIdentities()[0].getCategory());
- CPPUNIT_ASSERT_EQUAL(String("en"), payload->getIdentities()[0].getLanguage());
- CPPUNIT_ASSERT_EQUAL(String("Vlug"), payload->getIdentities()[1].getName());
- CPPUNIT_ASSERT_EQUAL(String("pc"), payload->getIdentities()[1].getType());
- CPPUNIT_ASSERT_EQUAL(String("client"), payload->getIdentities()[1].getCategory());
- CPPUNIT_ASSERT_EQUAL(String("nl"), payload->getIdentities()[1].getLanguage());
- CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(payload->getFeatures().size()));
- CPPUNIT_ASSERT_EQUAL(String("foo-feature"), payload->getFeatures()[0]);
- CPPUNIT_ASSERT_EQUAL(String("bar-feature"), payload->getFeatures()[1]);
- CPPUNIT_ASSERT_EQUAL(String("baz-feature"), payload->getFeatures()[2]);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(DiscoInfoParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
deleted file mode 100644
index dcd3172..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/ErrorParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class ErrorParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(ErrorParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- ErrorParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<error type=\"modify\">"
- "<bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
- "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
- "</error>"));
-
- 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());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ErrorParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h
deleted file mode 100644
index 20a5feb..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/UnitTest/ParserTester.h"
-#include "Swiften/Parser/PayloadParser.h"
-
-namespace Swift {
- typedef ParserTester<PayloadParser> PayloadParserTester;
-}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
deleted file mode 100644
index ac167cf..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Parser/XMLParser.h"
-#include "Swiften/Parser/XMLParserClient.h"
-#include "Swiften/Parser/PlatformXMLParserFactory.h"
-
-namespace Swift {
- class PayloadsParserTester : public XMLParserClient {
- public:
- PayloadsParserTester() : level(0) {
- xmlParser = PlatformXMLParserFactory().createXMLParser(this);
- }
-
- ~PayloadsParserTester() {
- delete xmlParser;
- }
-
- bool parse(const String& data) {
- return xmlParser->parse(data);
- }
-
- virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
- if (level == 0) {
- CPPUNIT_ASSERT(!payloadParser.get());
- PayloadParserFactory* payloadParserFactory = factories.getPayloadParserFactory(element, ns, attributes);
- CPPUNIT_ASSERT(payloadParserFactory);
- payloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- payloadParser->handleStartElement(element, ns, attributes);
- level++;
- }
-
- virtual void handleEndElement(const String& element, const String& ns) {
- level--;
- payloadParser->handleEndElement(element, ns);
- }
-
- virtual void handleCharacterData(const String& data) {
- payloadParser->handleCharacterData(data);
- }
-
- boost::shared_ptr<Payload> getPayload() const {
- return payloadParser->getPayload();
- }
-
- private:
- XMLParser* xmlParser;
- FullPayloadParserFactoryCollection factories;
- std::auto_ptr<PayloadParser> payloadParser;
- int level;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
deleted file mode 100644
index acea437..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/PriorityParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class PriorityParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(PriorityParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- PriorityParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<priority>-120</priority>"));
-
- Priority* payload = dynamic_cast<Priority*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(-120, payload->getPriority());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(PriorityParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp
deleted file mode 100644
index e820083..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Elements/Storage.h"
-#include "Swiften/Parser/PayloadParsers/PrivateStorageParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h"
-
-using namespace Swift;
-
-class PrivateStorageParserTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(PrivateStorageParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST(testParse_NoPayload);
- CPPUNIT_TEST(testParse_MultiplePayloads);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- PrivateStorageParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<query xmlns='jabber:iq:private'>"
- "<storage xmlns='storage:bookmarks'>"
- "<conference name='Swift' jid='swift@rooms.swift.im'>"
- "<nick>Alice</nick>"
- "</conference>"
- "</storage>"
- "</query>"));
-
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
- CPPUNIT_ASSERT(payload);
- boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload());
- CPPUNIT_ASSERT(storage);
- CPPUNIT_ASSERT_EQUAL(String("Alice"), storage->getConferences()[0].nick);
- CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getConferences()[0].jid);
- }
-
- void testParse_NoPayload() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<query xmlns='jabber:iq:private'/>"));
-
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
- CPPUNIT_ASSERT(payload);
- CPPUNIT_ASSERT(!payload->getPayload());
- }
-
- void testParse_MultiplePayloads() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<query xmlns='jabber:iq:private'>"
- "<storage xmlns='storage:bookmarks'>"
- "<conference name='Swift' jid='swift@rooms.swift.im'>"
- "<nick>Alice</nick>"
- "</conference>"
- "</storage>"
- "<storage xmlns='storage:bookmarks'>"
- "<conference name='Swift' jid='swift@rooms.swift.im'>"
- "<nick>Rabbit</nick>"
- "</conference>"
- "</storage>"
- "</query>"));
-
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
- CPPUNIT_ASSERT(payload);
- boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload());
- CPPUNIT_ASSERT(storage);
- CPPUNIT_ASSERT_EQUAL(String("Rabbit"), storage->getConferences()[0].nick);
- }
-
- void testParse_UnsupportedPayload() {
- PayloadParserFactoryCollection factories;
- PrivateStorageParser testling(&factories);
- PayloadParserTester parser(&testling);
-
- CPPUNIT_ASSERT(parser.parse(
- "<query xmlns='jabber:iq:private'>"
- "<foo>Bar</foo>"
- "</query>"));
-
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<PrivateStorage>(testling.getPayload())->getPayload());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(PrivateStorageParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp
deleted file mode 100644
index 81cc207..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h"
-
-using namespace Swift;
-
-class RawXMLPayloadParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(RawXMLPayloadParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- RawXMLPayloadParserTest() {}
-
- void testParse() {
- RawXMLPayloadParser testling;
- PayloadParserTester parser(&testling);
-
- String xml =
- "<foo foo-attr=\"foo-val\" xmlns=\"ns:foo\">"
- "<bar bar-attr=\"bar-val\" xmlns=\"ns:bar\"/>"
- "<baz baz-attr=\"baz-val\" xmlns=\"ns:baz\"/>"
- "</foo>";
- CPPUNIT_ASSERT(parser.parse(xml));
-
- RawXMLPayload* payload = dynamic_cast<RawXMLPayload*>(testling.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(xml, payload->getRawXML());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(RawXMLPayloadParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp
deleted file mode 100644
index b1b61ef..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/ResourceBindParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class ResourceBindParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(ResourceBindParserTest);
- CPPUNIT_TEST(testParse_JID);
- CPPUNIT_TEST(testParse_Resource);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- ResourceBindParserTest() {}
-
- void testParse_JID() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>somenode@example.com/someresource</jid></bind>"));
-
- ResourceBind* payload = dynamic_cast<ResourceBind*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(JID("somenode@example.com/someresource"), payload->getJID());
- }
-
- void testParse_Resource() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>someresource</resource></bind>"));
-
- ResourceBind* payload = dynamic_cast<ResourceBind*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("someresource"), payload->getResource());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ResourceBindParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
deleted file mode 100644
index 4c8db07..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/RosterParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class RosterParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(RosterParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- RosterParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
- parser.parse(
- "<query xmlns='jabber:iq:roster'>"
- " <item jid='foo@bar.com' name='Foo @ Bar' subscription='from' ask='subscribe'>"
- " <group>Group 1</group>"
- " <group>Group 2</group>"
- " </item>"
- " <item jid='baz@blo.com' name='Baz'/>"
- "</query>");
-
- RosterPayload* payload = dynamic_cast<RosterPayload*>(parser.getPayload().get());
- const RosterPayload::RosterItemPayloads& items = payload->getItems();
-
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items.size());
-
- CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com"), items[0].getJID());
- CPPUNIT_ASSERT_EQUAL(String("Foo @ Bar"), items[0].getName());
- CPPUNIT_ASSERT_EQUAL(RosterItemPayload::From, items[0].getSubscription());
- CPPUNIT_ASSERT(items[0].getSubscriptionRequested());
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items[0].getGroups().size());
- CPPUNIT_ASSERT_EQUAL(String("Group 1"), items[0].getGroups()[0]);
- CPPUNIT_ASSERT_EQUAL(String("Group 2"), items[0].getGroups()[1]);
-
- CPPUNIT_ASSERT_EQUAL(JID("baz@blo.com"), items[1].getJID());
- CPPUNIT_ASSERT_EQUAL(String("Baz"), items[1].getName());
- CPPUNIT_ASSERT_EQUAL(RosterItemPayload::None, items[1].getSubscription());
- CPPUNIT_ASSERT(!items[1].getSubscriptionRequested());
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), items[1].getGroups().size());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(RosterParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp
deleted file mode 100644
index 8272bee..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/SecurityLabelParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class SecurityLabelParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(SecurityLabelParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- SecurityLabelParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
- "<displaymarking fgcolor=\"black\" bgcolor=\"red\">SECRET</displaymarking>"
- "<label>"
- "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"
- "</label>"
- "<equivalentlabel>"
- "<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>"
- "</equivalentlabel>"
- "<equivalentlabel>"
- "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"
- "</equivalentlabel>"
- "</securitylabel>"));
-
- SecurityLabel* payload = dynamic_cast<SecurityLabel*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("SECRET"), payload->getDisplayMarking());
- CPPUNIT_ASSERT_EQUAL(String("black"), payload->getForegroundColor());
- CPPUNIT_ASSERT_EQUAL(String("red"), payload->getBackgroundColor());
- CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabel());
- CPPUNIT_ASSERT_EQUAL(String("<icismlabel classification=\"S\" disseminationControls=\"FOUO\" ownerProducer=\"USA\" xmlns=\"http://example.gov/IC-ISM/0\"/>"), payload->getEquivalentLabels()[0]);
- CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"), payload->getEquivalentLabels()[1]);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp
deleted file mode 100644
index b2378b6..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(SecurityLabelsCatalogParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- SecurityLabelsCatalogParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<catalog desc=\"an example set of labels\" name=\"Default\" to=\"example.com\" xmlns=\"urn:xmpp:sec-label:catalog:0\">"
- "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
- "<displaymarking bgcolor=\"red\" fgcolor=\"black\">SECRET</displaymarking>"
- "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel></label>"
- "</securitylabel>"
- "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
- "<displaymarking bgcolor=\"navy\" fgcolor=\"black\">CONFIDENTIAL</displaymarking>"
- "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel></label>"
- "</securitylabel>"
- "</catalog>"));
-
- SecurityLabelsCatalog* payload = dynamic_cast<SecurityLabelsCatalog*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("Default"), payload->getName());
- CPPUNIT_ASSERT_EQUAL(String("an example set of labels"), payload->getDescription());
- CPPUNIT_ASSERT_EQUAL(JID("example.com"), payload->getTo());
- CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getLabels().size()));
- CPPUNIT_ASSERT_EQUAL(String("SECRET"), payload->getLabels()[0].getDisplayMarking());
- CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getLabels()[0].getLabel());
- CPPUNIT_ASSERT_EQUAL(String("CONFIDENTIAL"), payload->getLabels()[1].getDisplayMarking());
- CPPUNIT_ASSERT_EQUAL(String("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"), payload->getLabels()[1].getLabel());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelsCatalogParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp
deleted file mode 100644
index eeaa8d9..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/SoftwareVersionParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class SoftwareVersionParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(SoftwareVersionParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- SoftwareVersionParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<query xmlns=\"jabber:iq:version\">"
- "<name>myclient</name>"
- "<version>1.0</version>"
- "<os>Mac OS X</os>"
- "</query>"));
-
- SoftwareVersion* payload = dynamic_cast<SoftwareVersion*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("myclient"), payload->getName());
- CPPUNIT_ASSERT_EQUAL(String("1.0"), payload->getVersion());
- CPPUNIT_ASSERT_EQUAL(String("Mac OS X"), payload->getOS());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(SoftwareVersionParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp
deleted file mode 100644
index 71d5b0b..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/StatusParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class StatusParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(StatusParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- StatusParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<status>foo<baz>bar</baz>fum</status>"));
-
- Status* payload = dynamic_cast<Status*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("foobarfum"), payload->getText());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(StatusParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp
deleted file mode 100644
index d45e98b..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/StatusShowParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class StatusShowParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(StatusShowParserTest);
- CPPUNIT_TEST(testParse_Invalid);
- CPPUNIT_TEST(testParse_Away);
- CPPUNIT_TEST(testParse_FFC);
- CPPUNIT_TEST(testParse_XA);
- CPPUNIT_TEST(testParse_DND);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- StatusShowParserTest() {}
-
- void testParse_Invalid() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<show>invalid</show>"));
-
- StatusShow* payload = dynamic_cast<StatusShow*>(parser.getPayload().get());
- CPPUNIT_ASSERT(StatusShow::Online == payload->getType());
- }
-
- void testParse_Away() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<show>away</show>"));
-
- StatusShow* payload = dynamic_cast<StatusShow*>(parser.getPayload().get());
- CPPUNIT_ASSERT(StatusShow::Away == payload->getType());
- }
-
- void testParse_FFC() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<show>chat</show>"));
-
- StatusShow* payload = dynamic_cast<StatusShow*>(parser.getPayload().get());
- CPPUNIT_ASSERT(StatusShow::FFC == payload->getType());
- }
-
- void testParse_XA() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<show>xa</show>"));
-
- StatusShow* payload = dynamic_cast<StatusShow*>(parser.getPayload().get());
- CPPUNIT_ASSERT(StatusShow::XA == payload->getType());
- }
-
- void testParse_DND() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse("<show>dnd</show>"));
-
- StatusShow* payload = dynamic_cast<StatusShow*>(parser.getPayload().get());
- CPPUNIT_ASSERT(StatusShow::DND == payload->getType());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(StatusShowParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp
deleted file mode 100644
index 3fbf27a..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/StorageParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class StorageParserTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(StorageParserTest);
- CPPUNIT_TEST(testParse_Conference);
- CPPUNIT_TEST(testParse_MultipleConferences);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- StorageParserTest() {}
-
- void testParse_Conference() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<storage xmlns='storage:bookmarks'>"
- "<conference "
- "name='Council of Oberon' "
- "autojoin='true' jid='council@conference.underhill.org'>"
- "<nick>Puck</nick>"
- "<password>MyPass</password>"
- "</conference>"
- "</storage>"));
-
- Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get());
- std::vector<Storage::Conference> conferences = payload->getConferences();
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(conferences.size()));
- CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name);
- CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid);
- CPPUNIT_ASSERT(conferences[0].autoJoin);
- CPPUNIT_ASSERT_EQUAL(String("Puck"), conferences[0].nick);
- CPPUNIT_ASSERT_EQUAL(String("MyPass"), conferences[0].password);
- }
-
- void testParse_MultipleConferences() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<storage xmlns='storage:bookmarks'>"
- "<conference "
- "name='Council of Oberon' "
- "jid='council@conference.underhill.org' />"
- "<conference "
- "name='Tea party' "
- "jid='teaparty@wonderland.lit' />"
- "</storage>"));
-
- Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get());
- std::vector<Storage::Conference> conferences = payload->getConferences();
- CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(conferences.size()));
- CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name);
- CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid);
- CPPUNIT_ASSERT_EQUAL(String("Tea party"), conferences[1].name);
- CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), conferences[1].jid);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(StorageParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
deleted file mode 100644
index d1ddba3..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/VCardParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class VCardParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(VCardParserTest);
- CPPUNIT_TEST(testParse_Photo);
- CPPUNIT_TEST(testParse_Nickname);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- VCardParserTest() {}
-
- void testParse_Photo() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<vCard xmlns='vcard-temp'>"
- "<PHOTO>"
- "<TYPE>image/jpeg</TYPE>"
- "<BINVAL>"
- "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ej"
- "EyMzQ1Njc4OTA="
- "</BINVAL>"
- "</PHOTO>"
- "</vCard>"));
-
- VCard* payload = dynamic_cast<VCard*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), payload->getPhotoType());
- CPPUNIT_ASSERT_EQUAL(ByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"), payload->getPhoto());
- }
-
- void testParse_Nickname() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<vCard xmlns='vcard-temp'>"
- "<NICKNAME>mynick</NICKNAME>"
- "</vCard>"));
-
- VCard* payload = dynamic_cast<VCard*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("mynick"), payload->getNickname());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(VCardParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp
deleted file mode 100644
index ef6c78e..0000000
--- a/Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Parser/PayloadParsers/VCardUpdateParser.h"
-#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h"
-
-using namespace Swift;
-
-class VCardUpdateParserTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(VCardUpdateParserTest);
- CPPUNIT_TEST(testParse);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- VCardUpdateParserTest() {}
-
- void testParse() {
- PayloadsParserTester parser;
-
- CPPUNIT_ASSERT(parser.parse(
- "<x xmlns='vcard-temp:x:update'>"
- "<photo>sha1-hash-of-image</photo>"
- "</x>"));
-
- VCardUpdate* payload = dynamic_cast<VCardUpdate*>(parser.getPayload().get());
- CPPUNIT_ASSERT_EQUAL(String("sha1-hash-of-image"), payload->getPhotoHash());
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateParserTest);
diff --git a/Swiften/Parser/PayloadParsers/VCardParser.cpp b/Swiften/Parser/PayloadParsers/VCardParser.cpp
deleted file mode 100644
index 87416ab..0000000
--- a/Swiften/Parser/PayloadParsers/VCardParser.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/VCardParser.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/StringCodecs/Base64.h"
-
-namespace Swift {
-
-VCardParser::VCardParser() {
-}
-
-void VCardParser::handleStartElement(const String& element, const String&, const AttributeMap&) {
- elementStack_.push_back(element);
- currentText_ = "";
-}
-
-void VCardParser::handleEndElement(const String&, const String&) {
- String elementHierarchy = getElementHierarchy();
- if (elementHierarchy == "/vCard/PHOTO/TYPE") {
- getPayloadInternal()->setPhotoType(currentText_);
- }
- else if (elementHierarchy == "/vCard/PHOTO/BINVAL") {
- getPayloadInternal()->setPhoto(Base64::decode(currentText_));
- }
- else if (elementHierarchy == "/vCard/NICKNAME") {
- getPayloadInternal()->setNickname(currentText_);
- }
- else if (elementHierarchy == "/vCard/FN") {
- getPayloadInternal()->setFullName(currentText_);
- }
- else if (elementHierarchy == "/vCard/N/FAMILY") {
- getPayloadInternal()->setFamilyName(currentText_);
- }
- else if (elementHierarchy == "/vCard/N/GIVEN") {
- getPayloadInternal()->setGivenName(currentText_);
- }
- else if (elementHierarchy == "/vCard/EMAIL/USERID") {
- getPayloadInternal()->setEMail(currentText_);
- }
- elementStack_.pop_back();
-}
-
-void VCardParser::handleCharacterData(const String& text) {
- currentText_ += text;
-}
-
-String VCardParser::getElementHierarchy() const {
- String result;
- foreach(const String& element, elementStack_) {
- result += "/" + element;
- }
- return result;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/VCardParser.h b/Swiften/Parser/PayloadParsers/VCardParser.h
deleted file mode 100644
index c1ed46b..0000000
--- a/Swiften/Parser/PayloadParsers/VCardParser.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include "Swiften/Elements/VCard.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class SerializingParser;
-
- class VCardParser : public GenericPayloadParser<VCard> {
- public:
- VCardParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- String getElementHierarchy() const;
-
- private:
- std::vector<String> elementStack_;
- String currentText_;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/VCardParserFactory.h b/Swiften/Parser/PayloadParsers/VCardParserFactory.h
deleted file mode 100644
index 2d5302b..0000000
--- a/Swiften/Parser/PayloadParsers/VCardParserFactory.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/VCardParser.h"
-
-namespace Swift {
- class VCardParserFactory : public GenericPayloadParserFactory<VCardParser> {
- public:
- VCardParserFactory() : GenericPayloadParserFactory<VCardParser>("vCard", "vcard-temp") {}
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp b/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp
deleted file mode 100644
index e195eb7..0000000
--- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "Swiften/Parser/PayloadParsers/VCardUpdateParser.h"
-
-namespace Swift {
-
-VCardUpdateParser::VCardUpdateParser() : level_(TopLevel) {
-}
-
-void VCardUpdateParser::handleStartElement(const String&, const String&, const AttributeMap&) {
- if (level_ == PayloadLevel) {
- currentText_ = "";
- }
- ++level_;
-}
-
-void VCardUpdateParser::handleEndElement(const String& element, const String&) {
- --level_;
- if (level_ == PayloadLevel && element == "photo") {
- getPayloadInternal()->setPhotoHash(currentText_);
- }
-}
-
-void VCardUpdateParser::handleCharacterData(const String& text) {
- currentText_ += text;
-}
-
-}
diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h
deleted file mode 100644
index 3682ccf..0000000
--- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include "Swiften/Elements/VCardUpdate.h"
-#include "Swiften/Parser/GenericPayloadParser.h"
-
-namespace Swift {
- class SerializingParser;
-
- class VCardUpdateParser : public GenericPayloadParser<VCardUpdate> {
- public:
- VCardUpdateParser();
-
- virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes);
- virtual void handleEndElement(const String& element, const String&);
- virtual void handleCharacterData(const String& data);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- String currentText_;
- };
-}
diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParserFactory.h b/Swiften/Parser/PayloadParsers/VCardUpdateParserFactory.h
deleted file mode 100644
index 0a8dddf..0000000
--- a/Swiften/Parser/PayloadParsers/VCardUpdateParserFactory.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "Swiften/Parser/GenericPayloadParserFactory.h"
-#include "Swiften/Parser/PayloadParsers/VCardUpdateParser.h"
-
-namespace Swift {
- class VCardUpdateParserFactory : public GenericPayloadParserFactory<VCardUpdateParser> {
- public:
- VCardUpdateParserFactory() : GenericPayloadParserFactory<VCardUpdateParser>("x", "vcard-temp:x:update") {}
- };
-}