From fabb5330d159667a0a1827d8e2dbbc2c90252d2e Mon Sep 17 00:00:00 2001 From: Adrian Perez de Castro Date: Mon, 4 Jul 2016 03:19:16 +0300 Subject: [PATCH] First pass at client:sync() For the moment only the amount of iterations, or processing events foerever, can be specified. The timeout is not yet configurable. --- matrix/client.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/matrix/client.lua b/matrix/client.lua index a899704..91faa0b 100644 --- a/matrix/client.lua +++ b/matrix/client.lua @@ -420,6 +420,15 @@ function Client:_sync(options) end end +function Client:sync(niters) + while niters == nil or niters > 0 do + self:_sync { timeout = 15000 } + if niters then + niters = niters - 1 + end + end +end + function Client:_sync_handle_room__join(room_id, data) local room = self:_make_room(room_id) room:_push_events(data.timeline.events)