cleaned up MatrixChat:get_sync_table()

This commit is contained in:
- 2022-01-28 19:07:30 -08:00
parent dab7d2f5b8
commit 04cf7b139e
1 changed files with 3 additions and 5 deletions

View File

@ -66,16 +66,14 @@ end
-- GET /sync
function MatrixChat:get_sync_table(timeout)
local params = {}
-- no filter param
if self.since ~= nil then
params[1] = "since=" .. self.since
table.insert(params, "since=" .. self.since)
end
if timeout ~= nil then
-- if timeout is defined and since took the starting '?'
params[2] = "timeout=" .. timeout
table.insert(params, "timeout=" .. timeout)
end
local u = self.server .."/_matrix/client/r0/sync"
if params[1] ~= nil then
if #params > 0 then
u = u .. "?" .. table.concat(params, "&")
end
local h = {"Authorization: Bearer " .. self.token}