Added channel show/hide system

canary
WolverinDEV 2018-08-10 11:27:03 +02:00
parent e337177315
commit 836847a9f1
1 changed files with 20 additions and 0 deletions

View File

@ -327,6 +327,8 @@ class ConnectionCommandHandler {
this["channellist"] = this.handleCommandChannelList;
this["notifychannelcreated"] = this.handleCommandChannelCreate;
this["notifychanneldeleted"] = this.handleCommandChannelDelete;
this["notifychannelhide"] = this.handleCommandChannelHide;
this["notifychannelshow"] = this.handleCommandChannelShow;
this["notifycliententerview"] = this.handleCommandClientEnterView;
this["notifyclientleftview"] = this.handleCommandClientLeftView;
@ -447,6 +449,10 @@ class ConnectionCommandHandler {
this.createChannelFromJson(json[0]);
}
handleCommandChannelShow(json) {
this.createChannelFromJson(json[0]); //TODO may chat?
}
handleCommandChannelDelete(json) {
let tree = this.connection._client.channelTree;
@ -461,6 +467,20 @@ class ConnectionCommandHandler {
}
}
handleCommandChannelHide(json) {
let tree = this.connection._client.channelTree;
console.log("Got " + json.length + " channel hides");
for(let index = 0; index < json.length; index++) {
let channel = tree.findChannel(json[index]["cid"]);
if(!channel) {
console.error("Invalid channel on hide (Unknown channel)");
continue;
}
tree.deleteChannel(channel);
}
}
handleCommandClientEnterView(json) {
json = json[0]; //Only one bulk
let tree = this.connection._client.channelTree;