summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r--Sluift/client.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index 75f675d..24ece85 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2013-2017 Isode Limited.
+ * Copyright (c) 2013-2018 Isode Limited.
* All rights reserved.
@@ -7,4 +7,2 @@
#include <boost/assign/list_of.hpp>
-#include <boost/lambda/bind.hpp>
-#include <boost/lambda/lambda.hpp>
@@ -44,3 +42,2 @@
using namespace Swift;
-namespace lambda = boost::lambda;
@@ -604,2 +601,29 @@ static void pushEvent(lua_State* L, const SluiftClient::Event& event) {
}
+ 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;
+ }
}
@@ -661,3 +685,5 @@ SLUIFT_LUA_FUNCTION(Client, get_next_event) {
event = client->getNextEvent(
- timeout, lambda::bind(&SluiftClient::Event::type, lambda::_1) == *type);
+ timeout, [&](const SluiftClient::Event& event) {
+ return event.type == *type;
+ });
}
@@ -703,3 +729,3 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
if (lua_type(L, -1) == LUA_TTABLE) {
- for (size_t i = 1; i <= lua_objlen(L, -1); ++i) {
+ for (size_t i = 1; i <= lua_rawlen(L, -1); ++i) {
lua_rawgeti(L, -1, boost::numeric_cast<int>(i));