You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2026-01-03 23:22:30 +03:00
Add isGuest/setGuest
This commit is contained in:
@@ -153,8 +153,8 @@ function MatrixClient(opts) {
|
||||
}
|
||||
this._syncState = null;
|
||||
this._syncingRetry = null;
|
||||
|
||||
this._guestRooms = null;
|
||||
this._isGuest = false;
|
||||
}
|
||||
utils.inherits(MatrixClient, EventEmitter);
|
||||
|
||||
@@ -191,6 +191,27 @@ MatrixClient.prototype.getSyncState = function() {
|
||||
return this._syncState;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return whether the client is configured for a guest account.
|
||||
* @return {boolean} True if this is a guest access_token (or no token is supplied).
|
||||
*/
|
||||
MatrixClient.prototype.isGuest = function() {
|
||||
return this._isGuest;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set whether this client is a guest account. <b>This method is experimental
|
||||
* and may change without warning.</b>
|
||||
* @param {boolean} isGuest True if this is a guest account.
|
||||
*/
|
||||
MatrixClient.prototype.setGuest = function(isGuest) {
|
||||
// EXPERIMENTAL:
|
||||
// If the token is a macaroon, it should be encoded in it that it is a 'guest'
|
||||
// access token, which means that the SDK can determine this entirely without
|
||||
// the dev manually flipping this flag.
|
||||
this._isGuest = isGuest;
|
||||
};
|
||||
|
||||
/**
|
||||
* Retry a backed off syncing request immediately. This should only be used when
|
||||
* the user <b>explicitly</b> attempts to retry their lost connection.
|
||||
|
||||
Reference in New Issue
Block a user