add background sync helper function (untested)
parent
0f23914c57
commit
63a896fcc3
23
src/tui.jl
23
src/tui.jl
|
@ -3,3 +3,26 @@ roomlist = Dict()
|
||||||
function updateroomlist(user::MatrixUser)
|
function updateroomlist(user::MatrixUser)
|
||||||
global roomlist = listjoined(user)
|
global roomlist = listjoined(user)
|
||||||
end
|
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
|
||||||
|
|
Loading…
Reference in New Issue