From 145a3e5098cb271c79036462ed5372eb2ad67979 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Fri, 18 Mar 2022 14:24:19 -0400 Subject: [PATCH 1/2] Support call room type from MSC3417 Signed-off-by: Robin Townsend --- src/@types/event.ts | 1 + src/models/room.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/@types/event.ts b/src/@types/event.ts index 98c7de32f88..9698cad7071 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -119,6 +119,7 @@ export const RoomCreateTypeField = "type"; export enum RoomType { Space = "m.space", + Call = "org.matrix.msc3417.call", } /** diff --git a/src/models/room.ts b/src/models/room.ts index 36137c899f7..9a3bb0dcada 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -2322,7 +2322,7 @@ export class Room extends TypedEventEmitter /** * Returns the type of the room from the `m.room.create` event content or undefined if none is set - * @returns {?string} the type of the room. Currently only RoomType.Space is known. + * @returns {?string} the type of the room. */ public getType(): RoomType | string | undefined { const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, ""); @@ -2344,6 +2344,14 @@ export class Room extends TypedEventEmitter return this.getType() === RoomType.Space; } + /** + * Returns whether the room is a call-room as defined by MSC3417. + * @returns {boolean} true if the room's type is RoomType.Call + */ + public isCallRoom(): boolean { + return this.getType() === RoomType.Call; + } + /** * This is an internal method. Calculates the name of the room from the current * room state. From b2f274d9e8272460ccb3bcadad5519847c602bcd Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Fri, 18 Mar 2022 18:05:32 -0400 Subject: [PATCH 2/2] Make it more clear that call room type is unstable Signed-off-by: Robin Townsend --- src/@types/event.ts | 2 +- src/models/room.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@types/event.ts b/src/@types/event.ts index 9698cad7071..05f85cc4742 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -119,7 +119,7 @@ export const RoomCreateTypeField = "type"; export enum RoomType { Space = "m.space", - Call = "org.matrix.msc3417.call", + UnstableCall = "org.matrix.msc3417.call", } /** diff --git a/src/models/room.ts b/src/models/room.ts index c94b447b6cf..f585debbf94 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -2438,10 +2438,10 @@ export class Room extends TypedEventEmitter /** * Returns whether the room is a call-room as defined by MSC3417. - * @returns {boolean} true if the room's type is RoomType.Call + * @returns {boolean} true if the room's type is RoomType.UnstableCall */ public isCallRoom(): boolean { - return this.getType() === RoomType.Call; + return this.getType() === RoomType.UnstableCall; } /**