diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp | 45 |
2 files changed, 0 insertions, 45 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c 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(); -} - -} |