diff --git a/lib/client.js b/lib/client.js index 47ae2c895..cfdeb4b2a 100644 --- a/lib/client.js +++ b/lib/client.js @@ -2080,6 +2080,10 @@ function doInitialSync(client, historyLen, includeArchived, attempt) { if (includeArchived) { qps.archived = true; } + if (client._guestRooms && client._isGuest) { + console.log(client._guestRooms); + qps.room_id = JSON.stringify(client._guestRooms); + } client._http.authedRequest( undefined, "GET", "/initialSync", qps ).done(function(data) { @@ -2251,6 +2255,16 @@ MatrixClient.prototype.startClient = function(opts) { }; function prepareForSync(client, attempt) { + if (client.isGuest()) { + // no push rules for guests + doInitialSync( + client, + client._config.initialSyncLimit, + client._config.includeArchivedRooms + ); + return; + } + attempt = attempt || 1; client.pushRules().done(function(result) { client.pushRules = result; diff --git a/spec/unit/matrix-client.spec.js b/spec/unit/matrix-client.spec.js index a50e89fa9..5d5093e7a 100644 --- a/spec/unit/matrix-client.spec.js +++ b/spec/unit/matrix-client.spec.js @@ -374,6 +374,10 @@ describe("MatrixClient", function() { ]; it("should be set via setGuestRooms and used in /events calls", function(done) { + httpLookups = []; // no /pushrules + httpLookups.push({ + method: "GET", path: "/initialSync", data: initialSyncData + }); httpLookups.push({ method: "GET", path: "/events",