summaryrefslogtreecommitdiffstats
path: root/Sluift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-26 11:41:09 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-26 11:42:47 (GMT)
commit23e82d08519c747e6d8d2add53d7e84b363687bb (patch)
treec78b371e240eb07fb2cd413d46da4ec2305f708c /Sluift
parent8d14d9b2e0e459df6ca974dadee447abb3293a98 (diff)
downloadswift-contrib-23e82d08519c747e6d8d2add53d7e84b363687bb.zip
swift-contrib-23e82d08519c747e6d8d2add53d7e84b363687bb.tar.bz2
Added an option to not use stream compression.
Diffstat (limited to 'Sluift')
-rw-r--r--Sluift/sluift.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Sluift/sluift.cpp b/Sluift/sluift.cpp
index b3ca8dc..086fb2a 100644
--- a/Sluift/sluift.cpp
+++ b/Sluift/sluift.cpp
@@ -72,6 +72,10 @@ class SluiftClient {
delete client;
}
+ Client* getClient() {
+ return client;
+ }
+
void connect() {
rosterReceived = false;
client->connect();
@@ -380,6 +384,17 @@ static int sluift_client_send_presence(lua_State *L) {
return 0;
}
+static int sluift_client_set_options(lua_State* L) {
+ SluiftClient* client = getClient(L);
+ luaL_checktype(L, 2, LUA_TTABLE);
+ lua_getfield(L, 2, "compress");
+ if (!lua_isnil(L, -1)) {
+ client->getClient()->setUseStreamCompression(lua_toboolean(L, -1));
+ }
+ lua_pop(L, -1);
+ return 0;
+}
+
static int sluift_client_for_event (lua_State *L) {
try {
SluiftClient* client = getClient(L);
@@ -460,6 +475,7 @@ static const luaL_reg sluift_client_functions[] = {
{"set_version", sluift_client_set_version},
{"get_roster", sluift_client_get_roster},
{"get_version", sluift_client_get_version},
+ {"set_options", sluift_client_set_options},
{"for_event", sluift_client_for_event},
{"__gc", sluift_client_gc},
{NULL, NULL}