diff options
author | Edwin Mons <edwin.mons@isode.com> | 2014-12-10 16:50:27 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-12-14 14:47:01 (GMT) |
commit | 6948ef81d66680858b88b1bc7dc67687310f57cf (patch) | |
tree | 3aeb638051bfac666924b7479ff201e095ae048c /Swiften/Parser/PayloadParsers | |
parent | b4a54583c4d575fe152122c21da616c3c942bbfd (diff) | |
download | swift-6948ef81d66680858b88b1bc7dc67687310f57cf.zip swift-6948ef81d66680858b88b1bc7dc67687310f57cf.tar.bz2 |
Add index element to ResultSet
The index element was missing, added it in Swiften and Sluift.
Change-Id: I709037fafcc5242c7c2e2fddb8469316c106d51a
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r-- | Swiften/Parser/PayloadParsers/ResultSetParser.cpp | 5 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/ResultSetParser.cpp b/Swiften/Parser/PayloadParsers/ResultSetParser.cpp index 4c8283b..4829f98 100644 --- a/Swiften/Parser/PayloadParsers/ResultSetParser.cpp +++ b/Swiften/Parser/PayloadParsers/ResultSetParser.cpp @@ -43,6 +43,11 @@ void ResultSetParser::handleEndElement(const std::string& element, const std::st getPayloadInternal()->setCount(boost::lexical_cast<int>(currentText_)); } catch(boost::bad_lexical_cast&) { } + } else if (element == "index") { + try { + getPayloadInternal()->setIndex(boost::lexical_cast<int>(currentText_)); + } catch(boost::bad_lexical_cast&) { + } } else if (element == "first") { getPayloadInternal()->setFirstID(currentText_); } else if (element == "last") { diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp index e345323..17d9eb2 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp @@ -26,6 +26,7 @@ class ResultSetParserTest : public CppUnit::TestFixture "<set xmlns=\"http://jabber.org/protocol/rsm\">" "<max>100</max>" "<count>800</count>" + "<index>0</index>" "<first index=\"123\">stpeter@jabber.org</first>" "<last>peterpan@neverland.lit</last>" "<before>decaf-badba-dbad1</before>" @@ -38,6 +39,8 @@ class ResultSetParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(100, *payload->getMaxItems()); CPPUNIT_ASSERT(payload->getCount()); CPPUNIT_ASSERT_EQUAL(800, *payload->getCount()); + CPPUNIT_ASSERT(payload->getIndex()); + CPPUNIT_ASSERT_EQUAL(0, *payload->getIndex()); CPPUNIT_ASSERT(payload->getFirstID()); CPPUNIT_ASSERT_EQUAL(std::string("stpeter@jabber.org"), *payload->getFirstID()); CPPUNIT_ASSERT(payload->getFirstIDIndex()); |