cleaned up MatrixChat:get_sync_table()
This commit is contained in:
parent
dab7d2f5b8
commit
04cf7b139e
8
init.lua
8
init.lua
|
@ -66,16 +66,14 @@ end
|
||||||
-- GET /sync
|
-- GET /sync
|
||||||
function MatrixChat:get_sync_table(timeout)
|
function MatrixChat:get_sync_table(timeout)
|
||||||
local params = {}
|
local params = {}
|
||||||
-- no filter param
|
|
||||||
if self.since ~= nil then
|
if self.since ~= nil then
|
||||||
params[1] = "since=" .. self.since
|
table.insert(params, "since=" .. self.since)
|
||||||
end
|
end
|
||||||
if timeout ~= nil then
|
if timeout ~= nil then
|
||||||
-- if timeout is defined and since took the starting '?'
|
table.insert(params, "timeout=" .. timeout)
|
||||||
params[2] = "timeout=" .. timeout
|
|
||||||
end
|
end
|
||||||
local u = self.server .."/_matrix/client/r0/sync"
|
local u = self.server .."/_matrix/client/r0/sync"
|
||||||
if params[1] ~= nil then
|
if #params > 0 then
|
||||||
u = u .. "?" .. table.concat(params, "&")
|
u = u .. "?" .. table.concat(params, "&")
|
||||||
end
|
end
|
||||||
local h = {"Authorization: Bearer " .. self.token}
|
local h = {"Authorization: Bearer " .. self.token}
|
||||||
|
|
Loading…
Reference in New Issue