Add prencence option in sync
parent
edb59b7a8e
commit
21d3fb2814
|
@ -1,6 +1,8 @@
|
||||||
function sync(u::MatrixUser;
|
function sync(u::MatrixUser;
|
||||||
timeout = 0, since::Union{String,Nothing} = nothing, full = false)
|
timeout = 0, since::Union{String,Nothing} = nothing, full = false,
|
||||||
|
presence = "offline")
|
||||||
req = Dict("timeout" => string(timeout),
|
req = Dict("timeout" => string(timeout),
|
||||||
|
"set_presence" => presence,
|
||||||
"full" => string(full))
|
"full" => string(full))
|
||||||
since === nothing ? nothing : (req["since"] = string(since))
|
since === nothing ? nothing : (req["since"] = string(since))
|
||||||
get(u, "sync"; extraquery = req)
|
get(u, "sync"; extraquery = req)
|
||||||
|
@ -9,9 +11,9 @@ end
|
||||||
function sync!(s::MatrixSync)
|
function sync!(s::MatrixSync)
|
||||||
# initial sync
|
# initial sync
|
||||||
res = s.last in [nothing, ""] ?
|
res = s.last in [nothing, ""] ?
|
||||||
sync(s.user, timeout = s.timeout, full = true) :
|
sync(s.user, timeout = s.timeout, full = true, presence = s.presence) :
|
||||||
# updates
|
# updates
|
||||||
sync(s.user, since = s.last, timeout = s.timeout, full = false)
|
sync(s.user, since = s.last, timeout = s.timeout, full = false, presence = s.presence)
|
||||||
res = JSON.parse(String(res.body))
|
res = JSON.parse(String(res.body))
|
||||||
s.last = res["next_batch"]
|
s.last = res["next_batch"]
|
||||||
s.sync = res
|
s.sync = res
|
||||||
|
|
|
@ -35,6 +35,7 @@ mutable struct MatrixSync
|
||||||
user::MatrixUser
|
user::MatrixUser
|
||||||
last::Union{Nothing,String}
|
last::Union{Nothing,String}
|
||||||
timeout::Int
|
timeout::Int
|
||||||
|
presence::String
|
||||||
sync
|
sync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue