diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp | 17 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp | 16 |
2 files changed, 16 insertions, 17 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp index 76c742c..c9ed6ea 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp @@ -22,17 +22,16 @@ std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<Ros 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.jid); - itemElement->setAttribute("name", item.name); - - switch (item.action) { - case RosterItemExchangePayload::Add: itemElement->setAttribute("action", "add"); break; - case RosterItemExchangePayload::Modify: itemElement->setAttribute("action", "modify"); break; - case RosterItemExchangePayload::Delete: itemElement->setAttribute("action", "delete"); break; - default: itemElement->setAttribute("action", "add"); break; + 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.groups) { + foreach(const std::string& group, item.getGroups()) { boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group))); itemElement->addNode(groupElement); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp index 0fb44c9..f4de783 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp @@ -25,17 +25,17 @@ class RosterItemExchangeSerializerTest : public CppUnit::TestFixture boost::shared_ptr<RosterItemExchangePayload> roster(new RosterItemExchangePayload()); RosterItemExchangePayload::Item item1; - item1.jid = JID("foo@bar.com"); - item1.name = "Foo @ Bar"; - item1.action = RosterItemExchangePayload::Add; - item1.groups.push_back("Group 1"); - item1.groups.push_back("Group 2"); + item1.setJID("foo@bar.com"); + item1.setName("Foo @ Bar"); + item1.setAction(RosterItemExchangePayload::Item::Add); + item1.addGroup("Group 1"); + item1.addGroup("Group 2"); roster->addItem(item1); RosterItemExchangePayload::Item item2; - item2.jid = JID("baz@blo.com"); - item2.name = "Baz"; - item2.action = RosterItemExchangePayload::Modify; + item2.setJID("baz@blo.com"); + item2.setName("Baz"); + item2.setAction(RosterItemExchangePayload::Item::Modify); roster->addItem(item2); std::string expectedResult = |