You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-23 22:42:10 +03:00
Add MatrixClient.setGuestRooms
This is used in /events to grab events for the rooms the Guest is interested in.
This commit is contained in:
@@ -153,6 +153,8 @@ function MatrixClient(opts) {
|
||||
}
|
||||
this._syncState = null;
|
||||
this._syncingRetry = null;
|
||||
|
||||
this._guestRooms = null;
|
||||
}
|
||||
utils.inherits(MatrixClient, EventEmitter);
|
||||
|
||||
@@ -1789,6 +1791,14 @@ MatrixClient.prototype.registerGuest = function(opts, callback) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a list of rooms the Guest is interested in receiving events from.
|
||||
* @param {String[]} A list of room IDs.
|
||||
*/
|
||||
MatrixClient.prototype.setGuestRooms = function(roomIds) {
|
||||
this._guestRooms = roomIds;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} username
|
||||
* @param {string} password
|
||||
@@ -2220,10 +2230,16 @@ function _pollForEvents(client, attempt) {
|
||||
_pollForEvents(client);
|
||||
}, timeoutMs + (20 * 1000)); // 20s buffer
|
||||
|
||||
client._http.authedRequest(undefined, "GET", "/events", {
|
||||
var queryParams = {
|
||||
from: client.store.getSyncToken(),
|
||||
timeout: timeoutMs
|
||||
}).done(function(data) {
|
||||
};
|
||||
if (client._guestRooms) {
|
||||
queryParams.room_id = client._guestRooms;
|
||||
}
|
||||
|
||||
client._http.authedRequest(undefined, "GET", "/events", queryParams).done(
|
||||
function(data) {
|
||||
if (discardResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user