2020-10-12 16:23:07 +02:00
|
|
|
export class RoomIdentifier {
|
|
|
|
public anonymous: boolean;
|
|
|
|
public id:string
|
|
|
|
constructor(roomID: string) {
|
2020-10-13 15:55:30 +02:00
|
|
|
if (roomID.startsWith('_/')) {
|
2020-10-12 16:23:07 +02:00
|
|
|
this.anonymous = true;
|
2020-10-13 15:55:30 +02:00
|
|
|
} else if(roomID.startsWith('@/')) {
|
2020-10-12 16:23:07 +02:00
|
|
|
this.anonymous = false;
|
|
|
|
} else {
|
|
|
|
throw new Error('Incorrect room ID: '+roomID);
|
|
|
|
}
|
|
|
|
this.id = roomID; //todo: extract more data from the id (like room slug, organization name, etc);
|
|
|
|
}
|
|
|
|
}
|