From 63a896fcc36d2e35c6aee21e978473ffdccb1f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Balzarotti?= Date: Tue, 18 Sep 2018 08:51:41 +0200 Subject: [PATCH] add background sync helper function (untested) --- src/tui.jl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tui.jl b/src/tui.jl index 6129858..3319876 100644 --- a/src/tui.jl +++ b/src/tui.jl @@ -3,3 +3,26 @@ roomlist = Dict() function updateroomlist(user::MatrixUser) global roomlist = listjoined(user) end + +function startsync() + background_sync(syncstatus) + + function showevent(_...) + global syncstatus + let ks = syncstatus.sync["rooms"]["join"] + for k in keys(ks) + try + for msg in ks[k]["timeline"]["events"] + println(MatrixMsg(msg["sender"], + msg["origin_server_ts"], + msg["content"]["msgtype"], + msg["content"]["body"])) + end + catch + continue + end + end + end + end + set_hook!(:sync, showevent) +end