diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index 051bb44a..77e02d76 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -185,6 +185,14 @@ export class HomeServerApi { getPushers(options = null) { return this._get("/pushers", null, null, options); } + + join(roomId, options = null) { + return this._post(`/rooms/${encodeURIComponent(roomId)}/join`, null, null, options); + } + + leave(roomId, options = null) { + return this._post(`/rooms/${encodeURIComponent(roomId)}/leave`, null, null, options); + } } import {Request as MockRequest} from "../../mocks/Request.js"; diff --git a/src/matrix/room/Invite.js b/src/matrix/room/Invite.js index 3a59594e..3508d111 100644 --- a/src/matrix/room/Invite.js +++ b/src/matrix/room/Invite.js @@ -70,11 +70,13 @@ export class Invite extends EventEmitter { async accept() { this._accepting = true; this._emitChange("accepting"); + await this._hsApi.join(this._roomId).response(); } async reject() { this._rejecting = true; this._emitChange("rejecting"); + await this._hsApi.leave(this._roomId).response(); } get accepting() {