diff --git a/init.lua b/init.lua index 578dfb1..c729021 100644 --- a/init.lua +++ b/init.lua @@ -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}