more tests, added ability to remove clients from a channel

This commit is contained in:
Josh Burman
2019-03-14 14:17:08 -04:00
parent 21f77fa4c3
commit 40691d9815
17 changed files with 316 additions and 5 deletions

View File

@ -55,6 +55,24 @@ class ChannelManager {
return new channelBase_1.default(data.channel);
}
}
removeClientFromChannel(client_id, channel_id) {
var index = 0;
for (let channel of this.channels) {
if (channel.id == channel_id) {
this.channels.splice(index, 1);
if (channel.removeClient(client_id)) {
logger.accessLog.info(`client removed from channel - channel: ${channel_id}, client: ${client_id}`);
return true;
}
else {
logger.errorLog.info(`client not removed from channel, or doesn't exist in channel - channel: ${channel_id}, client: ${client_id}`);
return false;
}
}
index++;
}
return false;
}
}
;
exports.default = ChannelManager;