Fix sync unbox method call

This commit is contained in:
Benoît Rouits 2020-05-31 23:45:16 +02:00
parent c4fd21a229
commit c96e4d460d
2 changed files with 3 additions and 4 deletions

View File

@ -42,7 +42,7 @@ function ssb_send(player, key, message)
if err then if err then
return (string.format("error happened: %s", err)) return (string.format("error happened: %s", err))
else else
minetest.log(json.encode(ret)) -- minetest.log(json.encode(ret))
local v = { local v = {
id = ret.key, id = ret.key,
sequence = ret.value.sequence + 1, sequence = ret.value.sequence + 1,
@ -69,7 +69,7 @@ function reap()
if ret ~= nil then if ret ~= nil then
if c.id == ret.value.previous and c.rcpt == ret.value.author then if c.id == ret.value.previous and c.rcpt == ret.value.author then
table.remove(v, i) -- end conversation table.remove(v, i) -- end conversation
local text = ssb:private():unbox(ret.value.content) local text = ssb:private():unbox(ret.value.content).text
local author = "ssb: " .. string.sub(ret.value.author, 1, 7) .. "..." local author = "ssb: " .. string.sub(ret.value.author, 1, 7) .. "..."
minetest.chat_send_player(p, author .. " replied: " .. text) minetest.chat_send_player(p, author .. " replied: " .. text)
end end

View File

@ -105,14 +105,13 @@ function rpc_source(conn, meth, mtype, param)
return ret, err return ret, err
end end
minetest.log(ret)
do_goodbye(conn) do_goodbye(conn)
return ret, err return ret, err
end end
function rpc_sync(conn, meth, mtype, param) function rpc_sync(conn, meth, mtype, param)
return rpc_source(conn, meth, mtype, param) return rpc_source(conn, meth, "async", param)
end end
function rpc_async(conn, meth, mtype, param) function rpc_async(conn, meth, mtype, param)