From 7467a0012e3ebe4eac723a9788e405fca9f1d6e0 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 3 Apr 2018 20:54:33 +0200 Subject: [PATCH] [lib.room-controller] 'VOICE' rooms can be toggled --- webpack/lib/room-controller.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webpack/lib/room-controller.js b/webpack/lib/room-controller.js index 32f1f19..90bbdcf 100644 --- a/webpack/lib/room-controller.js +++ b/webpack/lib/room-controller.js @@ -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 )