summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Planas <roger.planas@isode.com>2018-11-16 11:04:27 (GMT)
committerRoger Planas <roger.planas@isode.com>2018-11-27 14:31:21 (GMT)
commit24ddcdb0a82cbd33deb5b72ad9f86f1c46fc9d13 (patch)
tree50dd6f7d520100e576b8824e137bf3246affd990 /Sluift/client.cpp
parent560b5642eeeee9135e8995c04f99613387a7bfa8 (diff)
downloadswift-24ddcdb0a82cbd33deb5b72ad9f86f1c46fc9d13.zip
swift-24ddcdb0a82cbd33deb5b72ad9f86f1c46fc9d13.tar.bz2
Sluift: Added handling of roster push event
Swiften handles roster push event notifications, but those were not passed to Sluift, so a Sluift client, when querying events, would not be aware if an XMPP server roster pushes. This patch adds extra events types to Sluift so that method for_each_event reports roster pushes notifications. Test-information: Used sluift client to retrieve all items after adding, removing and updating roster items, and now Sluift clients can see these events. Change-Id: Ide5597bf2b39e3cc20014c66ba9153c551eec670
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r--Sluift/client.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index ec208bc..24ece85 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -599,6 +599,33 @@ static void pushEvent(lua_State* L, const SluiftClient::Event& event) {
Lua::registerTableToString(L, -1);
break;
}
+ case SluiftClient::Event::RosterAddType: {
+ Lua::Table result = boost::assign::map_list_of
+ ("type", std::make_shared<Lua::Value>(std::string("rosterpush")))
+ ("jid", std::make_shared<Lua::Value>(event.item.toString()))
+ ("action", std::make_shared<Lua::Value>(std::string("added")));
+ Lua::pushValue(L, result);
+ Lua::registerTableToString(L, -1);
+ break;
+ }
+ case SluiftClient::Event::RosterRemoveType: {
+ Lua::Table result = boost::assign::map_list_of
+ ("type", std::make_shared<Lua::Value>(std::string("rosterpush")))
+ ("jid", std::make_shared<Lua::Value>(event.item.toString()))
+ ("action", std::make_shared<Lua::Value>(std::string("removed")));
+ Lua::pushValue(L, result);
+ Lua::registerTableToString(L, -1);
+ break;
+ }
+ case SluiftClient::Event::RosterUpdateType: {
+ Lua::Table result = boost::assign::map_list_of
+ ("type", std::make_shared<Lua::Value>(std::string("rosterpush")))
+ ("jid", std::make_shared<Lua::Value>(event.item.toString()))
+ ("action", std::make_shared<Lua::Value>(std::string("updated")));
+ Lua::pushValue(L, result);
+ Lua::registerTableToString(L, -1);
+ break;
+ }
}
}