Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/@types/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const RoomCreateTypeField = "type";

export enum RoomType {
Space = "m.space",
UnstableCall = "org.matrix.msc3417.call",
}

/**
Expand Down
10 changes: 9 additions & 1 deletion src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ export class Room extends TypedEventEmitter<EmittedEvents, RoomEventHandlerMap>

/**
* 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, "");
Expand All @@ -2436,6 +2436,14 @@ export class Room extends TypedEventEmitter<EmittedEvents, RoomEventHandlerMap>
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.UnstableCall
*/
public isCallRoom(): boolean {
return this.getType() === RoomType.UnstableCall;
}

/**
* This is an internal method. Calculates the name of the room from the current
* room state.
Expand Down