[lib.room-controller] fix sending { rid: }
This commit is contained in:
parent
2f5894c459
commit
bcf4dafcc5
|
@ -27,7 +27,7 @@ export default class ChannelController{
|
|||
---------------------------------------------------------*/
|
||||
nav(channel_id=null){
|
||||
|
||||
console.log(`channel.nav(${channel_id})`);
|
||||
// console.log(`channel.nav(${channel_id})`);
|
||||
|
||||
/* (1) Get channel data */
|
||||
var channel = this.get(channel_id);
|
||||
|
@ -48,7 +48,7 @@ export default class ChannelController{
|
|||
gs.get.room.fetch();
|
||||
|
||||
/* (6) Open channel websocket */
|
||||
( window.csock != null ) && csock.close();
|
||||
( window.csock != null ) && csock.close();
|
||||
window.csock = new wscd(`wss://ws.douscord.xdrm.io/channel/${channel.id}`, { token: auth.token });
|
||||
csock.onreceive = (_dat) => {
|
||||
|
||||
|
@ -62,7 +62,7 @@ export default class ChannelController{
|
|||
csock.bind();
|
||||
|
||||
/* (6) Log channel */
|
||||
console.log(`[channel.current] ${channel.link} (${channel.label})`);
|
||||
// console.log(`[channel.current] ${channel.link} (${channel.label})`);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ export default class ChannelController{
|
|||
*
|
||||
---------------------------------------------------------*/
|
||||
dump(channels){
|
||||
console.log(`channel.dump([${channels instanceof Array?channels.length:0}])`);
|
||||
// console.log(`channel.dump([${channels instanceof Array?channels.length:0}])`);
|
||||
|
||||
/* (1) Check @channels type */
|
||||
if( !(channels instanceof Array) )
|
||||
|
@ -197,7 +197,7 @@ export default class ChannelController{
|
|||
}
|
||||
|
||||
/* (4) Emulate navigatation from URL */
|
||||
console.log(`[restore.channel] ${redirect_id}`);
|
||||
// console.log(`[restore.channel] ${redirect_id}`);
|
||||
this.nav(redirect_id);
|
||||
|
||||
}.bind(this), auth.token);
|
||||
|
|
|
@ -29,7 +29,7 @@ export default class RoomController{
|
|||
*
|
||||
---------------------------------------------------------*/
|
||||
nav(type=null, id=null){
|
||||
console.log(`room.nav(${type}, ${id})`);
|
||||
// console.log(`room.nav(${type}, ${id})`);
|
||||
|
||||
/* (1) Try to get current room from id */
|
||||
let room = this.get(type, id);
|
||||
|
@ -38,21 +38,21 @@ export default class RoomController{
|
|||
if( Object.keys(room).length == 0 )
|
||||
return false;
|
||||
|
||||
/* (3) Close last room */
|
||||
|
||||
/* (4) Open new room */
|
||||
|
||||
/* (5) Update @active room */
|
||||
/* (3) Update @active room */
|
||||
this[type].current = room.id;
|
||||
|
||||
/* (6) Update buffer */
|
||||
/* (4) Open new room */
|
||||
if( type === 'text' && csock instanceof wscd )
|
||||
csock.send({ buffer: { rid: room.id } });
|
||||
|
||||
/* (5) Update buffer */
|
||||
this._buffer[type] = {};
|
||||
for( let r of this[type].list )
|
||||
if( r.id === this[type].current )
|
||||
this._buffer[type] = r;
|
||||
|
||||
|
||||
console.log(`[room.${type}.opened] ${room.name} (${room.id})`, room.id);
|
||||
// console.log(`[room.${type}.opened] ${room.name} (${room.id})`, room.id);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -76,7 +76,7 @@ export default class RoomController{
|
|||
---------------------------------------------------------*/
|
||||
dump(rooms, append=false){
|
||||
|
||||
console.log(`room.dump([${rooms instanceof Array?rooms.length:-1}])`);
|
||||
// console.log(`room.dump([${rooms instanceof Array?rooms.length:-1}])`);
|
||||
|
||||
/* (1) Check @rooms type */
|
||||
if( !(rooms instanceof Array) )
|
||||
|
@ -149,7 +149,7 @@ export default class RoomController{
|
|||
*
|
||||
---------------------------------------------------------*/
|
||||
get(type=null, id=null){
|
||||
console.log(`room.get(${type}, ${id})`);
|
||||
// console.log(`room.get(${type}, ${id})`);
|
||||
|
||||
/* (1) Manage invalid @type */
|
||||
if( typeof type !== 'string' || this[type] == null )
|
||||
|
@ -208,7 +208,6 @@ export default class RoomController{
|
|||
/* (3) Store channel users */
|
||||
gs.get.content.cbuf.users = rs.channel.users;
|
||||
|
||||
|
||||
}.bind(this), auth.token);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue