Skip to content

Commit

Permalink
Merge pull request #557 from turt2live/travis/presence
Browse files Browse the repository at this point in the history
Support set_presence=offline for syncing
  • Loading branch information
ara4n authored Nov 14, 2017
2 parents d357283 + 7c851fa commit c707d3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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 @@ -545,6 +547,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

0 comments on commit c707d3d

Please sign in to comment.