[lib.room-controller] 'VOICE' rooms can be toggled

This commit is contained in:
xdrm-brackets 2018-04-03 20:54:33 +02:00
parent bcf4dafcc5
commit 7467a0012e
1 changed files with 9 additions and 4 deletions

View File

@ -38,14 +38,19 @@ export default class RoomController{
if( Object.keys(room).length == 0 )
return false;
/* (3) Update @active room */
this[type].current = room.id;
/* (3) VOICE room : toggle @active */
if( type === 'voice' )
this[type].current = (this[type].current === room.id) ? null : room.id;
/* (4) Open new room */
/* (4) Update @active room */
if( type === 'text' )
this[type].current = room.id;
/* (5) Tell websocket: new text room */
if( type === 'text' && csock instanceof wscd )
csock.send({ buffer: { rid: room.id } });
/* (5) Update buffer */
/* (6) Update buffer */
this._buffer[type] = {};
for( let r of this[type].list )
if( r.id === this[type].current )