diff --git a/src/sync.jl b/src/sync.jl index 914b5ee..2f15e5b 100644 --- a/src/sync.jl +++ b/src/sync.jl @@ -1,6 +1,8 @@ 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), + "set_presence" => presence, "full" => string(full)) since === nothing ? nothing : (req["since"] = string(since)) get(u, "sync"; extraquery = req) @@ -9,9 +11,9 @@ end function sync!(s::MatrixSync) # initial sync 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 - 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)) s.last = res["next_batch"] s.sync = res diff --git a/src/types.jl b/src/types.jl index 00cd6f8..7ce79a4 100644 --- a/src/types.jl +++ b/src/types.jl @@ -35,6 +35,7 @@ mutable struct MatrixSync user::MatrixUser last::Union{Nothing,String} timeout::Int + presence::String sync end