summaryrefslogtreecommitdiffstats
path: root/Sluift
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 /Sluift
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 'Sluift')
-rw-r--r--Sluift/ElementConvertors/MAMQueryConvertor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Sluift/ElementConvertors/MAMQueryConvertor.cpp b/Sluift/ElementConvertors/MAMQueryConvertor.cpp
index cf4f787..6217eb7 100644
--- a/Sluift/ElementConvertors/MAMQueryConvertor.cpp
+++ b/Sluift/ElementConvertors/MAMQueryConvertor.cpp
@@ -31,6 +31,11 @@ boost::shared_ptr<MAMQuery> MAMQueryConvertor::doConvertFromLua(lua_State* L) {
result->setQueryID(std::string(lua_tostring(L, -1)));
}
lua_pop(L, 1);
+ lua_getfield(L, -1, "node");
+ if (lua_isstring(L, -1)) {
+ result->setNode(std::string(lua_tostring(L, -1)));
+ }
+ lua_pop(L, 1);
lua_getfield(L, -1, "form");
if (!lua_isnil(L, -1)) {
boost::shared_ptr<Form> form = boost::dynamic_pointer_cast<Form>(convertors->convertFromLuaUntyped(L, -1, "form"));
@@ -56,6 +61,10 @@ void MAMQueryConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<MAMQuery>
lua_pushstring(L, (*payload->getQueryID()).c_str());
lua_setfield(L, -2, "query_id");
}
+ if (payload->getNode()) {
+ lua_pushstring(L, (*payload->getNode()).c_str());
+ lua_setfield(L, -2, "node");
+ }
if (convertors->convertToLuaUntyped(L, payload->getForm()) > 0) {
lua_setfield(L, -2, "form");
}
@@ -69,6 +78,7 @@ boost::optional<LuaElementConvertor::Documentation> MAMQueryConvertor::getDocume
"MAMQuery",
"This table has the following fields:\n\n"
"- `query_id`: string (Optional)\n"
+ "- `node`: string (Optional)\n"
"- `form`: string @{Form} (Optional)\n"
"- `result_set`: @{ResultSet} (Optional)\n"
);