summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2014-10-30 09:22:16 (GMT)
committerSwift Review <review@swift.im>2014-10-30 22:40:07 (GMT)
commit9b762e1cf26cfe12cf601d9ea95cf91b3f95c799 (patch)
tree854e8e602a1e98b38d66cc716f4ef878620d531b /Swiften/Parser/PayloadParsers
parent8096f80861667381b777af774cfd446d6fc8cda8 (diff)
downloadswift-9b762e1cf26cfe12cf601d9ea95cf91b3f95c799.zip
swift-9b762e1cf26cfe12cf601d9ea95cf91b3f95c799.tar.bz2
Add node attribute to MAMQuery
Added node to MAMQuery, the serializers, unit tests and the Sluift ElementConvertor. Test-Information: Unit tests pass on OS X 10.9 Sluift script querying a pubsub archive sent the right query. Change-Id: If8620104a11b402d7b51a6e9b34ccbe1b7e6d15a
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r--Swiften/Parser/PayloadParsers/MAMQueryParser.cpp3
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp3
2 files changed, 5 insertions, 1 deletions
diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
index 6b3dc65..b0b279d 100644
--- a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
@@ -22,6 +22,9 @@ void MAMQueryParser::handleStartElement(const std::string& element, const std::s
if ((attributeValue = attributes.getAttributeValue("queryid"))) {
getPayloadInternal()->setQueryID(*attributeValue);
}
+ if ((attributeValue = attributes.getAttributeValue("node"))) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
} else if (level_ == PayloadLevel) {
if (element == "x" && ns == "jabber:x:data") {
formParser_ = boost::make_shared<FormParser>();
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
index e1c8e3e..541f2af 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
@@ -26,7 +26,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture
void testParse() {
PayloadsParserTester parser;
CPPUNIT_ASSERT(parser.parse(
- "<query queryid=\"id0\" xmlns=\"urn:xmpp:mam:0\">"
+ "<query queryid=\"id0\" xmlns=\"urn:xmpp:mam:0\" node=\"node1\">"
"<x type=\"form\" xmlns=\"jabber:x:data\">"
"<field type=\"text-single\" var=\"FORM_TYPE\">"
"<value>urn:xmpp:mam:0</value>"
@@ -45,6 +45,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getQueryID());
CPPUNIT_ASSERT_EQUAL(std::string("id0"), *payload->getQueryID());
+ CPPUNIT_ASSERT_EQUAL(std::string("node1"), *payload->getNode());
CPPUNIT_ASSERT(payload->getForm());
boost::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE");