Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support set_presence=offline for syncing #557

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down