diff options
| author | Remko Tronçon <git@el-tramo.be> | 2014-01-24 21:32:56 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2014-01-24 21:32:56 (GMT) | 
| commit | 740e8d0146b93ade6ba34f0f6cb524e46b26d2cb (patch) | |
| tree | d9453524754459142aad889f4b9d9e09a17a2486 | |
| parent | 3c2225d42cc6b20618246f4b6de6fd6335c6b474 (diff) | |
| download | swift-740e8d0146b93ade6ba34f0f6cb524e46b26d2cb.zip swift-740e8d0146b93ade6ba34f0f6cb524e46b26d2cb.tar.bz2 | |
Sluift: Fix PubSubNode.subscribe
- Make sure 'sluift' is available in core.lua
- Parse the options correctly
Change-Id: I6f830372412008aa61c9203dc4f2f1b2f63b001b
| -rw-r--r-- | Sluift/core.lua | 7 | ||||
| -rw-r--r-- | Sluift/sluift.cpp | 3 | 
2 files changed, 7 insertions, 3 deletions
| diff --git a/Sluift/core.lua b/Sluift/core.lua index 1969690..9e81575 100644 --- a/Sluift/core.lua +++ b/Sluift/core.lua @@ -4,6 +4,7 @@  	See the COPYING file for more information.  --]] +local sluift = select(1, ...)  local _G = _G  local pairs, ipairs, print, tostring, type, error, assert, next, rawset, xpcall, unpack = pairs, ipairs, print, tostring, type, error, assert, next, rawset, xpcall, unpack  local setmetatable, getmetatable = setmetatable, getmetatable @@ -891,7 +892,8 @@ end  function PubSubNode:subscribe(...) -	local options = parse_options(...) +	local options = parse_options({}, ...) +	tprint(options)  	local jid = options.jid or sluift.jid.to_bare(self.client:jid())  	return self.client:query_pubsub(merge_tables(  		{ type = 'set', to = self.jid, query = {  @@ -903,7 +905,8 @@ function PubSubNode:unsubscribe(options)  	options = options or {}  	return self.client:query_pubsub(merge_tables(  		{ type = 'set', to = self.jid, query = {  -				_type = 'pubsub_unsubscribe', node = self.node, jid = options['jid'] } +				_type = 'pubsub_unsubscribe', node = self.node, jid = options['jid'],  +				subscription_id = 'subscription_id'}  		}, options))  end diff --git a/Sluift/sluift.cpp b/Sluift/sluift.cpp index 17990e8..50b287b 100644 --- a/Sluift/sluift.cpp +++ b/Sluift/sluift.cpp @@ -321,7 +321,8 @@ SLUIFT_API int luaopen_sluift(lua_State* L) {  	if (luaL_loadbuffer(L, core_lua, core_lua_size, "core.lua") != 0) {  		lua_error(L);  	} -	lua_call(L, 0, 1); +	lua_pushvalue(L, -2); +	lua_call(L, 1, 1);  	Sluift::globals.coreLibIndex = luaL_ref(L, LUA_REGISTRYINDEX);  	lua_rawgeti(L, LUA_REGISTRYINDEX, Sluift::globals.coreLibIndex); | 
 Swift
 Swift