diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp index 54c31bd..f0b19e1 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp @@ -26,28 +26,28 @@ RosterItemExchangeSerializer::RosterItemExchangeSerializer() : GenericPayloadSer } std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<RosterItemExchangePayload> roster) const { - XMLElement queryElement("x", "http://jabber.org/protocol/rosterx"); - foreach(const RosterItemExchangePayload::Item& item, roster->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); - itemElement->setAttribute("jid", item.getJID()); - itemElement->setAttribute("name", item.getName()); - - switch (item.getAction()) { - case RosterItemExchangePayload::Item::Add: itemElement->setAttribute("action", "add"); break; - case RosterItemExchangePayload::Item::Modify: itemElement->setAttribute("action", "modify"); break; - case RosterItemExchangePayload::Item::Delete: itemElement->setAttribute("action", "delete"); break; - } - - foreach(const std::string& group, item.getGroups()) { - boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); - groupElement->addNode(boost::make_shared<XMLTextNode>(group)); - itemElement->addNode(groupElement); - } - - queryElement.addNode(itemElement); - } - - return queryElement.serialize(); + XMLElement queryElement("x", "http://jabber.org/protocol/rosterx"); + foreach(const RosterItemExchangePayload::Item& item, roster->getItems()) { + boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + itemElement->setAttribute("jid", item.getJID()); + itemElement->setAttribute("name", item.getName()); + + switch (item.getAction()) { + case RosterItemExchangePayload::Item::Add: itemElement->setAttribute("action", "add"); break; + case RosterItemExchangePayload::Item::Modify: itemElement->setAttribute("action", "modify"); break; + case RosterItemExchangePayload::Item::Delete: itemElement->setAttribute("action", "delete"); break; + } + + foreach(const std::string& group, item.getGroups()) { + boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); + groupElement->addNode(boost::make_shared<XMLTextNode>(group)); + itemElement->addNode(groupElement); + } + + queryElement.addNode(itemElement); + } + + return queryElement.serialize(); } } |