From 7c851faba6d276ef495ccc385589fef3578c5b27 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 14 Oct 2017 14:34:37 -0600 Subject: [PATCH] Support set_presence=offline for syncing Signed-off-by: Travis Ralston --- src/client.js | 3 +++ src/sync.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/client.js b/src/client.js index 1da561e75c2..f5c70006e7c 100644 --- a/src/client.js +++ b/src/client.js @@ -2983,6 +2983,9 @@ MatrixClient.prototype.getTurnServers = function() { * * @param {Filter=} opts.filter The filter to apply to /sync calls. This will override * the opts.initialSyncLimit, which would normally result in a timeline limit filter. + * + * @param {Boolean=} opts.disablePresence True to perform syncing without automatically + * updating presence. */ MatrixClient.prototype.startClient = function(opts) { if (this.clientRunning) { diff --git a/src/sync.js b/src/sync.js index cc2d7a5f250..86f3247e3c6 100644 --- a/src/sync.js +++ b/src/sync.js @@ -71,6 +71,8 @@ function debuglog(...params) { * SAFELY remove events from this room. It may not be safe to remove events if * there are other references to the timelines for this room. * Default: returns false. + * @param {Boolean=} opts.disablePresence True to perform syncing without automatically + * updating presence. */ function SyncApi(client, opts) { this.client = client; @@ -543,6 +545,10 @@ SyncApi.prototype._sync = async function(syncOptions) { timeout: pollTimeout, }; + if (this.opts.disablePresence) { + qps.set_presence = "offline"; + } + if (syncToken) { qps.since = syncToken; } else {