summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-12 18:35:30 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-18 19:11:42 (GMT)
commit509973e7e5978c2225fb89a10a1e2343fce21e7b (patch)
treed8ea2cdc00d42f709103a1a1c0b7777c192e71a7 /Swiften/Serializer
parente0578b8fc582d431cce61ecac833ecf7031f6e75 (diff)
downloadswift-contrib-509973e7e5978c2225fb89a10a1e2343fce21e7b.zip
swift-contrib-509973e7e5978c2225fb89a10a1e2343fce21e7b.tar.bz2
Small tweaks to the roster item exchange payload.
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp17
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp16
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 =