summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/ResultSetParser.cpp5
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp3
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());