///
///
///
///
///
///
///
///
///
enum ViewReasonId {
VREASON_USER_ACTION = 0,
VREASON_MOVED = 1,
VREASON_SYSTEM = 2,
VREASON_TIMEOUT = 3,
VREASON_CHANNEL_KICK = 4,
VREASON_SERVER_KICK = 5,
VREASON_BAN = 6,
VREASON_SERVER_STOPPED = 7,
VREASON_SERVER_LEFT = 8,
VREASON_CHANNEL_UPDATED = 9,
VREASON_EDITED = 10,
VREASON_SERVER_SHUTDOWN = 11
}
class TSClient {
channelTree: ChannelTree;
serverConnection: ServerConnection;
voiceConnection: VoiceConnection;
fileManager: FileManager;
selectInfo: InfoBar;
permissions: PermissionManager;
groups: GroupManager;
controlBar: ControlBar;
settings: Settings;
private _clientId: number = 0;
private _ownEntry: LocalClientEntry;
constructor() {
this.settings = new Settings(this);
this.selectInfo = new InfoBar(this, $("#select_info"));
this.channelTree = new ChannelTree(this, $("#channelTree"));
this.serverConnection = new ServerConnection(this); //87.106.252.164
this.fileManager = new FileManager(this);
this.permissions = new PermissionManager(this);
this.groups = new GroupManager(this);
this.voiceConnection = new VoiceConnection(this);
this._ownEntry = new LocalClientEntry(this);
this.controlBar = new ControlBar(this, $("#control_bar"));
this.channelTree.registerClient(this._ownEntry);
}
setup() {
const self = this;
this.serverConnection.on_connected = function () {
console.log("Client connected!");
self.settings.loadServer();
chat.serverChat().appendMessage("Connected");
self.serverConnection.sendCommand("channelsubscribeall");
self.permissions.requestPermissionList();
if(self.groups.serverGroups.length == 0)
self.groups.requestGroups();
};
this.controlBar.initialise();
}
startConnection(addr: string) {
let idx = addr.lastIndexOf(':');
let port: number;
let host: string;
if(idx != -1) {
port = Number.parseInt(addr.substr(idx + 1));
host = addr.substr(0, idx);
} else {
host = addr;
port = 19978;
}
this.serverConnection.startConnection(host, port);
}
getClient() : LocalClientEntry { return this._ownEntry; }
getClientId(){ return this._clientId; } //TODO here
set clientId(id: number) {
this._clientId = id;
this._ownEntry["_clientId"] = id;
}
getServerConnection() : ServerConnection { return this.serverConnection; }
/**
* LISTENER
*/
onConnected() {
}
//Sould be triggered by `notifyclientleftview`
handleOwnDisconnect(json) {
}
}