diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
53 files changed, 0 insertions, 1467 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Serializer/PayloadSerializers/BodySerializer.h b/Swiften/Serializer/PayloadSerializers/BodySerializer.h deleted file mode 100644 index 7fba561..0000000 --- a/Swiften/Serializer/PayloadSerializers/BodySerializer.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SWIFTEN_BodySerializer_H -#define SWIFTEN_BodySerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Elements/Body.h" - -namespace Swift { - class BodySerializer : public GenericPayloadSerializer<Body> { - public: - BodySerializer() : GenericPayloadSerializer<Body>() {} - - virtual String serializePayload(boost::shared_ptr<Body> body) const { - XMLTextNode textNode(body->getText()); - return "<body>" + textNode.serialize() + "</body>"; - } - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp deleted file mode 100644 index fbb72af..0000000 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Serializer/XML/XMLElement.h" - -namespace Swift { - -CapsInfoSerializer::CapsInfoSerializer() : GenericPayloadSerializer<CapsInfo>() { -} - -String CapsInfoSerializer::serializePayload(boost::shared_ptr<CapsInfo> capsInfo) const { - XMLElement capsElement("c", "http://jabber.org/protocol/caps"); - capsElement.setAttribute("node", capsInfo->getNode()); - capsElement.setAttribute("hash", capsInfo->getHash()); - capsElement.setAttribute("ver", capsInfo->getVersion()); - return capsElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h deleted file mode 100644 index cb4fa33..0000000 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_CapsInfoSerializer_H -#define SWIFTEN_CapsInfoSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/CapsInfo.h" - -namespace Swift { - class CapsInfoSerializer : public GenericPayloadSerializer<CapsInfo> { - public: - CapsInfoSerializer(); - - virtual String serializePayload(boost::shared_ptr<CapsInfo>) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp deleted file mode 100644 index 0507092..0000000 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h" - -namespace Swift { - -ChatStateSerializer::ChatStateSerializer() : GenericPayloadSerializer<ChatState>() { -} - -String ChatStateSerializer::serializePayload(boost::shared_ptr<ChatState> chatState) const { - String result("<"); - switch (chatState->getChatState()) { - case ChatState::Active: result += "active"; break; - case ChatState::Composing: result += "composing"; break; - case ChatState::Paused: result += "paused"; break; - case ChatState::Inactive: result += "inactive"; break; - case ChatState::Gone: result += "gone"; break; - default: result += "gone"; break; - } - result += " xmlns=\"http://jabber.org/protocol/chatstates\"/>"; - return result; -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h deleted file mode 100644 index e99b8b6..0000000 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/ChatState.h" - -namespace Swift { - class ChatStateSerializer : public GenericPayloadSerializer<ChatState> { - public: - ChatStateSerializer(); - - virtual String serializePayload(boost::shared_ptr<ChatState> error) const; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp deleted file mode 100644 index 4c39574..0000000 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLElement.h" - -namespace Swift { - -DiscoInfoSerializer::DiscoInfoSerializer() : GenericPayloadSerializer<DiscoInfo>() { -} - -String DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoInfo) const { - XMLElement queryElement("query", "http://jabber.org/protocol/disco#info"); - if (!discoInfo->getNode().isEmpty()) { - queryElement.setAttribute("node", discoInfo->getNode()); - } - foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) { - boost::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); - if (!identity.getLanguage().isEmpty()) { - identityElement->setAttribute("xml:lang", identity.getLanguage()); - } - identityElement->setAttribute("category", identity.getCategory()); - identityElement->setAttribute("name", identity.getName()); - identityElement->setAttribute("type", identity.getType()); - queryElement.addNode(identityElement); - } - foreach(const String& feature, discoInfo->getFeatures()) { - boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); - featureElement->setAttribute("var", feature); - queryElement.addNode(featureElement); - } - return queryElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h deleted file mode 100644 index 929a455..0000000 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_DiscoInfoSerializer_H -#define SWIFTEN_DiscoInfoSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/DiscoInfo.h" - -namespace Swift { - class DiscoInfoSerializer : public GenericPayloadSerializer<DiscoInfo> { - public: - DiscoInfoSerializer(); - - virtual String serializePayload(boost::shared_ptr<DiscoInfo>) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp deleted file mode 100644 index f5ce478..0000000 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" - -namespace Swift { - -ErrorSerializer::ErrorSerializer() : GenericPayloadSerializer<ErrorPayload>() { -} - -String ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const { - String result("<error type=\""); - switch (error->getType()) { - case ErrorPayload::Continue: result += "continue"; break; - case ErrorPayload::Modify: result += "modify"; break; - case ErrorPayload::Auth: result += "auth"; break; - case ErrorPayload::Wait: result += "wait"; break; - default: result += "cancel"; break; - } - result += "\">"; - - String conditionElement; - switch (error->getCondition()) { - case ErrorPayload::BadRequest: conditionElement = "bad-request"; break; - case ErrorPayload::Conflict: conditionElement = "conflict"; break; - case ErrorPayload::FeatureNotImplemented: conditionElement = "feature-not-implemented"; break; - case ErrorPayload::Forbidden: conditionElement = "forbidden"; break; - case ErrorPayload::Gone: conditionElement = "gone"; break; - case ErrorPayload::InternalServerError: conditionElement = "internal-server-error"; break; - case ErrorPayload::ItemNotFound: conditionElement = "item-not-found"; break; - case ErrorPayload::JIDMalformed: conditionElement = "jid-malformed"; break; - case ErrorPayload::NotAcceptable: conditionElement = "not-acceptable"; break; - case ErrorPayload::NotAllowed: conditionElement = "not-allowed"; break; - case ErrorPayload::NotAuthorized: conditionElement = "not-authorized"; break; - case ErrorPayload::PaymentRequired: conditionElement = "payment-required"; break; - case ErrorPayload::RecipientUnavailable: conditionElement = "recipient-unavailable"; break; - case ErrorPayload::Redirect: conditionElement = "redirect"; break; - case ErrorPayload::RegistrationRequired: conditionElement = "registration-required"; break; - case ErrorPayload::RemoteServerNotFound: conditionElement = "remote-server-not-found"; break; - case ErrorPayload::RemoteServerTimeout: conditionElement = "remote-server-timeout"; break; - case ErrorPayload::ResourceConstraint: conditionElement = "resource-constraint"; break; - case ErrorPayload::ServiceUnavailable: conditionElement = "service-unavailable"; break; - case ErrorPayload::SubscriptionRequired: conditionElement = "subscription-required"; break; - case ErrorPayload::UnexpectedRequest: conditionElement = "unexpected-request"; break; - default: conditionElement = "undefined-condition"; break; - } - result += "<" + conditionElement + " xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"; - - if (!error->getText().isEmpty()) { - XMLTextNode textNode(error->getText()); - result += "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">" + textNode.serialize() + "</text>"; - } - - result += "</error>"; - return result; -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h deleted file mode 100644 index 931596f..0000000 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_ErrorSerializer_H -#define SWIFTEN_ErrorSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/ErrorPayload.h" - -namespace Swift { - class ErrorSerializer : public GenericPayloadSerializer<ErrorPayload> { - public: - ErrorSerializer(); - - virtual String serializePayload(boost::shared_ptr<ErrorPayload> error) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp deleted file mode 100644 index accf6c6..0000000 --- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/PayloadSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/BodySerializer.h" -#include "Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/PrioritySerializer.h" -#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/StatusSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/StorageSerializer.h" -#include "Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h" - -namespace Swift { - -FullPayloadSerializerCollection::FullPayloadSerializerCollection() { - serializers_.push_back(new BodySerializer()); - serializers_.push_back(new ChatStateSerializer()); - serializers_.push_back(new PrioritySerializer()); - serializers_.push_back(new ErrorSerializer()); - serializers_.push_back(new RosterSerializer()); - serializers_.push_back(new MUCPayloadSerializer()); - serializers_.push_back(new SoftwareVersionSerializer()); - serializers_.push_back(new StatusSerializer()); - serializers_.push_back(new StatusShowSerializer()); - serializers_.push_back(new DiscoInfoSerializer()); - serializers_.push_back(new CapsInfoSerializer()); - serializers_.push_back(new ResourceBindSerializer()); - serializers_.push_back(new StartSessionSerializer()); - serializers_.push_back(new SecurityLabelSerializer()); - serializers_.push_back(new SecurityLabelsCatalogSerializer()); - serializers_.push_back(new VCardSerializer()); - serializers_.push_back(new VCardUpdateSerializer()); - serializers_.push_back(new RawXMLPayloadSerializer()); - serializers_.push_back(new StorageSerializer()); - serializers_.push_back(new PrivateStorageSerializer(this)); - foreach(PayloadSerializer* serializer, serializers_) { - addSerializer(serializer); - } -} - -FullPayloadSerializerCollection::~FullPayloadSerializerCollection() { - foreach(PayloadSerializer* serializer, serializers_) { - removeSerializer(serializer); - delete serializer; - } - serializers_.clear(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h deleted file mode 100644 index e1655b5..0000000 --- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef SWIFTEN_FULLPAYLOADSERIALIZERCOLLECTION_H -#define SWIFTEN_FULLPAYLOADSERIALIZERCOLLECTION_H - -#include <vector> - -#include "Swiften/Serializer/PayloadSerializerCollection.h" - -namespace Swift { - class FullPayloadSerializerCollection : public PayloadSerializerCollection { - public: - FullPayloadSerializerCollection(); - ~FullPayloadSerializerCollection(); - - private: - std::vector<PayloadSerializer*> serializers_; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp deleted file mode 100644 index 9c701cc..0000000 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h" - -namespace Swift { - -MUCPayloadSerializer::MUCPayloadSerializer() : GenericPayloadSerializer<MUCPayload>() { -} - -String MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload>) const { - String result("<x xmlns='http://jabber.org/protocol/muc'/>"); - return result; -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h deleted file mode 100644 index 504c969..0000000 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_MUCPayloadSerializer_H -#define SWIFTEN_MUCPayloadSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/MUCPayload.h" - -namespace Swift { - class MUCPayloadSerializer : public GenericPayloadSerializer<MUCPayload> { - public: - MUCPayloadSerializer(); - - virtual String serializePayload(boost::shared_ptr<MUCPayload> version) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h deleted file mode 100644 index f132b6e..0000000 --- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SWIFTEN_PrioritySerializer_H -#define SWIFTEN_PrioritySerializer_H - -#include <boost/lexical_cast.hpp> - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/Priority.h" - -namespace Swift { - class PrioritySerializer : public GenericPayloadSerializer<Priority> { - public: - PrioritySerializer() : GenericPayloadSerializer<Priority>() {} - - virtual String serializePayload(boost::shared_ptr<Priority> priority) const { - return "<priority>" + boost::lexical_cast<std::string>(priority->getPriority()) + "</priority>"; - } - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp deleted file mode 100644 index 999252c..0000000 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Serializer/XML/XMLRawTextNode.h" -#include "Swiften/Serializer/PayloadSerializerCollection.h" - -namespace Swift { - -PrivateStorageSerializer::PrivateStorageSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { -} - -String PrivateStorageSerializer::serializePayload(boost::shared_ptr<PrivateStorage> storage) const { - XMLElement storageElement("query", "jabber:iq:private"); - boost::shared_ptr<Payload> payload = storage->getPayload(); - if (payload) { - PayloadSerializer* serializer = serializers->getPayloadSerializer(payload); - if (serializer) { - storageElement.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializer->serialize(payload)))); - } - } - return storageElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h deleted file mode 100644 index c655634..0000000 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/PrivateStorage.h" - -namespace Swift { - class PayloadSerializerCollection; - - class PrivateStorageSerializer : public GenericPayloadSerializer<PrivateStorage> { - public: - PrivateStorageSerializer(PayloadSerializerCollection* serializers); - - virtual String serializePayload(boost::shared_ptr<PrivateStorage>) const; - - private: - PayloadSerializerCollection* serializers; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h deleted file mode 100644 index f980174..0000000 --- a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/RawXMLPayload.h" - -namespace Swift { - class RawXMLPayloadSerializer : public GenericPayloadSerializer<RawXMLPayload> { - public: - RawXMLPayloadSerializer() : GenericPayloadSerializer<RawXMLPayload>() {} - - virtual String serializePayload(boost::shared_ptr<RawXMLPayload> p) const { - return p->getRawXML(); - } - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp deleted file mode 100644 index 93ab136..0000000 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" - -namespace Swift { - -ResourceBindSerializer::ResourceBindSerializer() : GenericPayloadSerializer<ResourceBind>() { -} - -String ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceBind> resourceBind) const { - XMLElement bindElement("bind", "urn:ietf:params:xml:ns:xmpp-bind"); - if (resourceBind->getJID().isValid()) { - boost::shared_ptr<XMLElement> jidNode(new XMLElement("jid")); - jidNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getJID().toString()))); - bindElement.addNode(jidNode); - } - else if (!resourceBind->getResource().isEmpty()) { - boost::shared_ptr<XMLElement> resourceNode(new XMLElement("resource")); - resourceNode->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(resourceBind->getResource()))); - bindElement.addNode(resourceNode); - } - return bindElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h deleted file mode 100644 index 61cf539..0000000 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_ResourceBindSerializer_H -#define SWIFTEN_ResourceBindSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/ResourceBind.h" - -namespace Swift { - class ResourceBindSerializer : public GenericPayloadSerializer<ResourceBind> { - public: - ResourceBindSerializer(); - - virtual String serializePayload(boost::shared_ptr<ResourceBind>) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp deleted file mode 100644 index 6329f86..0000000 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Serializer/XML/XMLElement.h" - -namespace Swift { - -RosterSerializer::RosterSerializer() : GenericPayloadSerializer<RosterPayload>() { -} - -String RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roster) const { - XMLElement queryElement("query", "jabber:iq:roster"); - foreach(const RosterItemPayload& item, roster->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); - itemElement->setAttribute("jid", item.getJID()); - itemElement->setAttribute("name", item.getName()); - - switch (item.getSubscription()) { - case RosterItemPayload::To: itemElement->setAttribute("subscription", "to"); break; - case RosterItemPayload::From: itemElement->setAttribute("subscription", "from"); break; - case RosterItemPayload::Both: itemElement->setAttribute("subscription", "both"); break; - case RosterItemPayload::Remove: itemElement->setAttribute("subscription", "remove"); break; - case RosterItemPayload::None: itemElement->setAttribute("subscription", "none"); break; - } - - if (item.getSubscriptionRequested()) { - itemElement->setAttribute("ask", "subscribe"); - } - - foreach(const String& group, item.getGroups()) { - boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); - groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group))); - itemElement->addNode(groupElement); - } - - queryElement.addNode(itemElement); - } - - return queryElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h deleted file mode 100644 index fb6a713..0000000 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_RosterSerializer_H -#define SWIFTEN_RosterSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/RosterPayload.h" - -namespace Swift { - class RosterSerializer : public GenericPayloadSerializer<RosterPayload> { - public: - RosterSerializer(); - - virtual String serializePayload(boost::shared_ptr<RosterPayload>) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp deleted file mode 100644 index dcce4dc..0000000 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLRawTextNode.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Serializer/XML/XMLElement.h" - -namespace Swift { - -SecurityLabelSerializer::SecurityLabelSerializer() : GenericPayloadSerializer<SecurityLabel>() { -} - -String SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel> label) const { - XMLElement element("securitylabel", "urn:xmpp:sec-label:0"); - if (!label->getDisplayMarking().isEmpty()) { - boost::shared_ptr<XMLElement> displayMarking(new XMLElement("displaymarking")); - if (!label->getForegroundColor().isEmpty()) { - displayMarking->setAttribute("fgcolor", label->getForegroundColor()); - } - if (!label->getBackgroundColor().isEmpty()) { - displayMarking->setAttribute("bgcolor", label->getBackgroundColor()); - } - displayMarking->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(label->getDisplayMarking()))); - element.addNode(displayMarking); - } - - boost::shared_ptr<XMLElement> labelElement(new XMLElement("label")); - labelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(label->getLabel()))); - element.addNode(labelElement); - - foreach(const String& equivalentLabel, label->getEquivalentLabels()) { - boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); - equivalentLabelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(equivalentLabel))); - element.addNode(equivalentLabelElement); - } - return element.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h deleted file mode 100644 index b0b0804..0000000 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_SecurityLabelSerializer_H -#define SWIFTEN_SecurityLabelSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/SecurityLabel.h" - -namespace Swift { - class SecurityLabelSerializer : public GenericPayloadSerializer<SecurityLabel> { - public: - SecurityLabelSerializer(); - - virtual String serializePayload(boost::shared_ptr<SecurityLabel> version) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp deleted file mode 100644 index bc6a41f..0000000 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h" -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLRawTextNode.h" -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" - -namespace Swift { - -SecurityLabelsCatalogSerializer::SecurityLabelsCatalogSerializer() : GenericPayloadSerializer<SecurityLabelsCatalog>() { -} - -String SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr<SecurityLabelsCatalog> catalog) const { - XMLElement element("catalog", "urn:xmpp:sec-label:catalog:0"); - if (!catalog->getName().isEmpty()) { - element.setAttribute("name", catalog->getName()); - } - if (catalog->getTo().isValid()) { - element.setAttribute("to", catalog->getTo()); - } - if (!catalog->getDescription().isEmpty()) { - element.setAttribute("desc", catalog->getDescription()); - } - foreach (const SecurityLabel& label, catalog->getLabels()) { - String serializedLabel = SecurityLabelSerializer().serialize(boost::shared_ptr<SecurityLabel>(new SecurityLabel(label))); - element.addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(serializedLabel))); - } - return element.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h deleted file mode 100644 index d086c79..0000000 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_SecurityLabelsCatalogSerializer_H -#define SWIFTEN_SecurityLabelsCatalogSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/SecurityLabelsCatalog.h" - -namespace Swift { - class SecurityLabelsCatalogSerializer : public GenericPayloadSerializer<SecurityLabelsCatalog> { - public: - SecurityLabelsCatalogSerializer(); - - virtual String serializePayload(boost::shared_ptr<SecurityLabelsCatalog> version) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp deleted file mode 100644 index 71ad9a2..0000000 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h" - -namespace Swift { - -SoftwareVersionSerializer::SoftwareVersionSerializer() : GenericPayloadSerializer<SoftwareVersion>() { -} - -String SoftwareVersionSerializer::serializePayload(boost::shared_ptr<SoftwareVersion> version) const { - String result("<query xmlns=\"jabber:iq:version\">"); - if (!version->getName().isEmpty()) { - result += "<name>" + version->getName() + "</name>"; - } - if (!version->getVersion().isEmpty()) { - result += "<version>" + version->getVersion() + "</version>"; - } - if (!version->getOS().isEmpty()) { - result += "<os>" + version->getOS() + "</os>"; - } - result += "</query>"; - return result; -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h deleted file mode 100644 index 50242f2..0000000 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SWIFTEN_SoftwareVersionSerializer_H -#define SWIFTEN_SoftwareVersionSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/SoftwareVersion.h" - -namespace Swift { - class SoftwareVersionSerializer : public GenericPayloadSerializer<SoftwareVersion> { - public: - SoftwareVersionSerializer(); - - virtual String serializePayload(boost::shared_ptr<SoftwareVersion> version) const; - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h deleted file mode 100644 index df35054..0000000 --- a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SWIFTEN_StartSessionSerializer_H -#define SWIFTEN_StartSessionSerializer_H - -#include <boost/lexical_cast.hpp> - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/StartSession.h" - -namespace Swift { - class StartSessionSerializer : public GenericPayloadSerializer<StartSession> { - public: - StartSessionSerializer() : GenericPayloadSerializer<StartSession>() {} - - virtual String serializePayload(boost::shared_ptr<StartSession>) const { - return XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session").serialize(); - } - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h deleted file mode 100644 index dc5f6d1..0000000 --- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SWIFTEN_StatusSerializer_H -#define SWIFTEN_StatusSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Elements/Status.h" - -namespace Swift { - class StatusSerializer : public GenericPayloadSerializer<Status> { - public: - StatusSerializer() : GenericPayloadSerializer<Status>() {} - - virtual String serializePayload(boost::shared_ptr<Status> status) const { - XMLElement element("status"); - element.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(status->getText()))); - return element.serialize(); - } - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h deleted file mode 100644 index f66c09c..0000000 --- a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SWIFTEN_StatusShowSerializer_H -#define SWIFTEN_StatusShowSerializer_H - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/StatusShow.h" - -namespace Swift { - class StatusShowSerializer : public GenericPayloadSerializer<StatusShow> { - public: - StatusShowSerializer() : GenericPayloadSerializer<StatusShow>() {} - - virtual String serializePayload(boost::shared_ptr<StatusShow> statusShow) const { - if (statusShow->getType () == StatusShow::Online || statusShow->getType() == StatusShow::None) { - return ""; - } - else { - String result("<show>"); - switch (statusShow->getType()) { - case StatusShow::Away: result += "away"; break; - case StatusShow::XA: result += "xa"; break; - case StatusShow::FFC: result += "chat"; break; - case StatusShow::DND: result += "dnd"; break; - case StatusShow::Online: assert(false); break; - case StatusShow::None: assert(false); break; - } - result += "</show>"; - return result; - } - } - }; -} - -#endif diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp deleted file mode 100644 index 4268381..0000000 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/StorageSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" - -namespace Swift { - -StorageSerializer::StorageSerializer() : GenericPayloadSerializer<Storage>() { -} - -String StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) const { - XMLElement storageElement("storage", "storage:bookmarks"); - foreach(const Storage::Conference& conference, storage->getConferences()) { - boost::shared_ptr<XMLElement> conferenceElement(new XMLElement("conference")); - conferenceElement->setAttribute("name", conference.name); - conferenceElement->setAttribute("jid", conference.jid); - conferenceElement->setAttribute("autojoin", conference.autoJoin ? "1" : "0"); - if (!conference.nick.isEmpty()) { - boost::shared_ptr<XMLElement> nickElement(new XMLElement("nick")); - nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(conference.nick))); - conferenceElement->addNode(nickElement); - } - if (!conference.password.isEmpty()) { - boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(conference.password))); - conferenceElement->addNode(passwordElement); - } - storageElement.addNode(conferenceElement); - } - return storageElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h deleted file mode 100644 index e657376..0000000 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/Storage.h" - -namespace Swift { - class StorageSerializer : public GenericPayloadSerializer<Storage> { - public: - StorageSerializer(); - - virtual String serializePayload(boost::shared_ptr<Storage>) const; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp deleted file mode 100644 index 650a7ee..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h" - -using namespace Swift; - -class CapsInfoSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(CapsInfoSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - CapsInfoSerializerTest() {} - - void testSerialize() { - CapsInfoSerializer testling; - boost::shared_ptr<CapsInfo> priority(new CapsInfo("http://swift.im", "myversion", "sha-1")); - - CPPUNIT_ASSERT_EQUAL(String("<c hash=\"sha-1\" node=\"http://swift.im\" ver=\"myversion\" xmlns=\"http://jabber.org/protocol/caps\"/>"), testling.serialize(priority)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(CapsInfoSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp deleted file mode 100644 index d3e247f..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h" - -using namespace Swift; - -class DiscoInfoSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(DiscoInfoSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - DiscoInfoSerializerTest() {} - - void testSerialize() { - DiscoInfoSerializer testling; - boost::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); - discoInfo->addIdentity(DiscoInfo::Identity("Swift", "client", "pc")); - discoInfo->addIdentity(DiscoInfo::Identity("Vlug", "client", "pc", "nl")); - discoInfo->addFeature("http://jabber.org/protocol/caps"); - discoInfo->addFeature("http://jabber.org/protocol/disco#info"); - discoInfo->setNode("http://swift.im#bla"); - - String expectedResult = - "<query node=\"http://swift.im#bla\" xmlns=\"http://jabber.org/protocol/disco#info\">" - "<identity category=\"client\" name=\"Swift\" type=\"pc\"/>" - "<identity category=\"client\" name=\"Vlug\" type=\"pc\" xml:lang=\"nl\"/>" - "<feature var=\"http://jabber.org/protocol/caps\"/>" - "<feature var=\"http://jabber.org/protocol/disco#info\"/>" - "</query>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(discoInfo)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(DiscoInfoSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp deleted file mode 100644 index ecd904a..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h" - -using namespace Swift; - -class ErrorSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(ErrorSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - ErrorSerializerTest() {} - - void testSerialize() { - ErrorSerializer testling; - boost::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error")); - - CPPUNIT_ASSERT_EQUAL(String("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(ErrorSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp deleted file mode 100644 index 23ff4a0..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" - -#include <cppunit/extensions/HelperMacros.h> - -#include "Swiften/Serializer/PayloadSerializer.h" - -namespace Swift { - -String PayloadsSerializer::serialize(boost::shared_ptr<Payload> payload) { - PayloadSerializer* serializer = serializers.getPayloadSerializer(payload); - if (serializer) { - return serializer->serialize(payload); - } - else { - CPPUNIT_ASSERT(false); - return ""; - } -} - - -} diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h deleted file mode 100644 index 9fca334..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" -#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" - -namespace Swift { - class PayloadsSerializer { - public: - String serialize(boost::shared_ptr<Payload> payload); - - private: - FullPayloadSerializerCollection serializers; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp deleted file mode 100644 index 5f6432b..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/PrioritySerializer.h" - -using namespace Swift; - -class PrioritySerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(PrioritySerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - PrioritySerializerTest() {} - - void testSerialize() { - PrioritySerializer testling; - boost::shared_ptr<Priority> priority(new Priority(-113)); - - CPPUNIT_ASSERT_EQUAL(String("<priority>-113</priority>"), testling.serialize(priority)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(PrioritySerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp deleted file mode 100644 index 7f0d5c9..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" -#include "Swiften/Elements/PrivateStorage.h" -#include "Swiften/Elements/Storage.h" - -using namespace Swift; - -class PrivateStorageSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(PrivateStorageSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - PrivateStorageSerializerTest() {} - - void testSerialize() { - PayloadsSerializer serializer; - - boost::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage()); - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Swift"; - conference.jid = JID("swift@rooms.swift.im"); - conference.nick = "Alice"; - storage->addConference(conference); - privateStorage->setPayload(storage); - - CPPUNIT_ASSERT_EQUAL(String( - "<query xmlns=\"jabber:iq:private\">" - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"0\" " - "jid=\"swift@rooms.swift.im\" " - "name=\"Swift\">" - "<nick>Alice</nick>" - "</conference>" - "</storage>" - "</query>"), serializer.serialize(privateStorage)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(PrivateStorageSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp deleted file mode 100644 index ff09966..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h" - -using namespace Swift; - -class ResourceBindSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(ResourceBindSerializerTest); - CPPUNIT_TEST(testSerialize_JID); - CPPUNIT_TEST(testSerialize_Resource); - CPPUNIT_TEST(testSerialize_Empty); - CPPUNIT_TEST_SUITE_END(); - - public: - ResourceBindSerializerTest() {} - - void testSerialize_JID() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - resourceBind->setJID(JID("somenode@example.com/someresource")); - - CPPUNIT_ASSERT_EQUAL(String( - "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" - "<jid>somenode@example.com/someresource</jid>" - "</bind>"), testling.serialize(resourceBind)); - } - - void testSerialize_Resource() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - resourceBind->setResource("someresource"); - - CPPUNIT_ASSERT_EQUAL(String( - "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" - "<resource>someresource</resource>" - "</bind>"), testling.serialize(resourceBind)); - } - - void testSerialize_Empty() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - - CPPUNIT_ASSERT_EQUAL(String("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"), testling.serialize(resourceBind)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(ResourceBindSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp deleted file mode 100644 index 81fdc09..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h" - -using namespace Swift; - -class RosterSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(RosterSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - RosterSerializerTest() {} - - void testSerialize() { - RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); - - RosterItemPayload item1; - item1.setJID(JID("foo@bar.com")); - item1.setName("Foo @ Bar"); - item1.setSubscription(RosterItemPayload::From); - item1.addGroup("Group 1"); - item1.addGroup("Group 2"); - item1.setSubscriptionRequested(); - roster->addItem(item1); - - RosterItemPayload item2; - item2.setJID(JID("baz@blo.com")); - item2.setName("Baz"); - roster->addItem(item2); - - String expectedResult = - "<query xmlns=\"jabber:iq:roster\">" - "<item ask=\"subscribe\" jid=\"foo@bar.com\" name=\"Foo @ Bar\" subscription=\"from\">" - "<group>Group 1</group>" - "<group>Group 2</group>" - "</item>" - "<item jid=\"baz@blo.com\" name=\"Baz\" subscription=\"none\"/>" - "</query>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(RosterSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp deleted file mode 100644 index e75695f..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" - -using namespace Swift; - -class SecurityLabelSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(SecurityLabelSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST(testSerialize_EmptyLabel); - CPPUNIT_TEST_SUITE_END(); - - public: - void testSerialize() { - SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); - securityLabel->setDisplayMarking("SECRET"); - securityLabel->setForegroundColor("black"); - securityLabel->setBackgroundColor("red"); - securityLabel->setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"); - securityLabel->addEquivalentLabel("<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>"); - securityLabel->addEquivalentLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"); - - CPPUNIT_ASSERT_EQUAL(String( - "<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>" - "<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>"), testling.serialize(securityLabel)); - } - - void testSerialize_EmptyLabel() { - SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); - securityLabel->setDisplayMarking("SECRET"); - securityLabel->setLabel(""); - - CPPUNIT_ASSERT_EQUAL(String( - "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking>SECRET</displaymarking>" - "<label></label>" - "</securitylabel>"), testling.serialize(securityLabel)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp deleted file mode 100644 index 3055aca..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h" - -using namespace Swift; - -class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(SecurityLabelsCatalogSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - SecurityLabelsCatalogSerializerTest() {} - - void testSerialize() { - SecurityLabelsCatalogSerializer testling; - boost::shared_ptr<SecurityLabelsCatalog> catalog(new SecurityLabelsCatalog()); - catalog->setTo(JID("example.com")); - catalog->setName("Default"); - catalog->setDescription("an example set of labels"); - - SecurityLabel securityLabel1; - securityLabel1.setDisplayMarking("SECRET"); - securityLabel1.setForegroundColor("black"); - securityLabel1.setBackgroundColor("red"); - securityLabel1.setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"); - catalog->addLabel(securityLabel1); - - SecurityLabel securityLabel2; - securityLabel2.setDisplayMarking("CONFIDENTIAL"); - securityLabel2.setForegroundColor("black"); - securityLabel2.setBackgroundColor("navy"); - securityLabel2.setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"); - catalog->addLabel(securityLabel2); - - CPPUNIT_ASSERT_EQUAL(String( - "<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>"), testling.serialize(catalog)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelsCatalogSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp deleted file mode 100644 index fd5dba5..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h" - -using namespace Swift; - -class SoftwareVersionSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(SoftwareVersionSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - SoftwareVersionSerializerTest() {} - - void testSerialize() { - SoftwareVersionSerializer testling; - boost::shared_ptr<SoftwareVersion> softwareVersion(new SoftwareVersion("Swift", "0.1", "Mac OS X")); - - CPPUNIT_ASSERT_EQUAL(String("<query xmlns=\"jabber:iq:version\"><name>Swift</name><version>0.1</version><os>Mac OS X</os></query>"), testling.serialize(softwareVersion)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SoftwareVersionSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp deleted file mode 100644 index 6dedacd..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/StatusSerializer.h" - -using namespace Swift; - -class StatusSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(StatusSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - StatusSerializerTest() {} - - void testSerialize() { - StatusSerializer testling; - boost::shared_ptr<Status> status(new Status("I am away")); - - CPPUNIT_ASSERT_EQUAL(String("<status>I am away</status>"), testling.serialize(status)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StatusSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp deleted file mode 100644 index 42e1c7c..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h" - -using namespace Swift; - -class StatusShowSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(StatusShowSerializerTest); - CPPUNIT_TEST(testSerialize_Online); - CPPUNIT_TEST(testSerialize_Away); - CPPUNIT_TEST(testSerialize_FFC); - CPPUNIT_TEST(testSerialize_XA); - CPPUNIT_TEST(testSerialize_DND); - CPPUNIT_TEST_SUITE_END(); - - public: - StatusShowSerializerTest() {} - - void testSerialize_Online() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); - } - - void testSerialize_Away() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away)); - CPPUNIT_ASSERT_EQUAL(String("<show>away</show>"), testling.serialize(statusShow)); - } - - void testSerialize_FFC() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC)); - CPPUNIT_ASSERT_EQUAL(String("<show>chat</show>"), testling.serialize(statusShow)); - } - - void testSerialize_XA() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA)); - CPPUNIT_ASSERT_EQUAL(String("<show>xa</show>"), testling.serialize(statusShow)); - } - - void testSerialize_DND() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND)); - CPPUNIT_ASSERT_EQUAL(String("<show>dnd</show>"), testling.serialize(statusShow)); - } - - void testSerialize_None() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StatusShowSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp deleted file mode 100644 index daf43c5..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" -#include "Swiften/Elements/Storage.h" - -using namespace Swift; - -class StorageSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(StorageSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST(testSerialize_NoNickOrPassword); - CPPUNIT_TEST_SUITE_END(); - - public: - StorageSerializerTest() {} - - void testSerialize() { - PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - conference.nick = "Puck"; - conference.password = "MyPass"; - storage->addConference(conference); - - CPPUNIT_ASSERT_EQUAL(String( - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"1\" " - "jid=\"council@conference.underhill.org\" " - "name=\"Council of Oberon\">" - "<nick>Puck</nick>" - "<password>MyPass</password>" - "</conference>" - "</storage>"), serializer.serialize(storage)); - } - - void testSerialize_NoNickOrPassword() { - PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - storage->addConference(conference); - - CPPUNIT_ASSERT_EQUAL(String( - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"1\" " - "jid=\"council@conference.underhill.org\" " - "name=\"Council of Oberon\"/>" - "</storage>"), serializer.serialize(storage)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StorageSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp deleted file mode 100644 index 23988d7..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h" - -using namespace Swift; - -class VCardUpdateSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(VCardUpdateSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - VCardUpdateSerializerTest() {} - - void testSerialize() { - VCardUpdateSerializer testling; - boost::shared_ptr<VCardUpdate> update(new VCardUpdate()); - update->setPhotoHash("sha1-hash-of-image"); - - String expectedResult = - "<x xmlns=\"vcard-temp:x:update\">" - "<photo>sha1-hash-of-image</photo>" - "</x>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(update)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp deleted file mode 100644 index fbb0274..0000000 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" - -namespace Swift { - -VCardSerializer::VCardSerializer() : GenericPayloadSerializer<VCard>() { -} - -String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const { - XMLElement queryElement("vCard", "vcard-temp"); - if (!vcard->getFullName().isEmpty()) { - boost::shared_ptr<XMLElement> fullNameElement(new XMLElement("FN")); - fullNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFullName()))); - queryElement.addNode(fullNameElement); - } - if (!vcard->getGivenName().isEmpty() || !vcard->getFamilyName().isEmpty()) { - boost::shared_ptr<XMLElement> nameElement(new XMLElement("N")); - if (!vcard->getFamilyName().isEmpty()) { - boost::shared_ptr<XMLElement> familyNameElement(new XMLElement("FAMILY")); - familyNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getFamilyName()))); - nameElement->addNode(familyNameElement); - } - if (!vcard->getGivenName().isEmpty()) { - boost::shared_ptr<XMLElement> givenNameElement(new XMLElement("GIVEN")); - givenNameElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getGivenName()))); - nameElement->addNode(givenNameElement); - } - queryElement.addNode(nameElement); - } - if (!vcard->getEMail().isEmpty()) { - boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL")); - boost::shared_ptr<XMLElement> userIDElement(new XMLElement("USERID")); - userIDElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getEMail()))); - emailElement->addNode(userIDElement); - queryElement.addNode(emailElement); - } - if (!vcard->getNickname().isEmpty()) { - boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME")); - nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname()))); - queryElement.addNode(nickElement); - } - // TODO - return queryElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h deleted file mode 100644 index baf5947..0000000 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/VCard.h" - -namespace Swift { - class VCardSerializer : public GenericPayloadSerializer<VCard> { - public: - VCardSerializer(); - - virtual String serializePayload(boost::shared_ptr<VCard>) const; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp deleted file mode 100644 index 540b48d..0000000 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h" - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Serializer/XML/XMLElement.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" - -namespace Swift { - -VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer<VCardUpdate>() { -} - -String VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate) const { - XMLElement updateElement("x", "vcard-temp:x:update"); - boost::shared_ptr<XMLElement> photoElement(new XMLElement("photo")); - photoElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcardUpdate->getPhotoHash()))); - updateElement.addNode(photoElement); - return updateElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h deleted file mode 100644 index e1373a9..0000000 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "Swiften/Serializer/GenericPayloadSerializer.h" -#include "Swiften/Elements/VCardUpdate.h" - -namespace Swift { - class VCardUpdateSerializer : public GenericPayloadSerializer<VCardUpdate> { - public: - VCardUpdateSerializer(); - - virtual String serializePayload(boost::shared_ptr<VCardUpdate>) const; - }; -} |