add background sync helper function (untested)

master
Nicolò Balzarotti 2018-09-18 08:51:41 +02:00
parent 0f23914c57
commit 63a896fcc3
1 changed files with 23 additions and 0 deletions

View File

@ -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