Show the server online count along with the server chat

Signed-off-by: WolverinDEV <git@teaspeak.de>
canary
WolverinDEV 2019-12-10 07:37:04 +01:00
parent 53a4cf8490
commit 587bb93eaa
No known key found for this signature in database
GPG Key ID: 77A6C15085150EEB
2 changed files with 17 additions and 0 deletions

View File

@ -1,4 +1,7 @@
# Changelog:
* **10.12.19**
- Show the server online count along the server chat
* **24.11.19**
- Fixed several bugs within the permission editor
- Hide senseless permissions (disableable via options)

View File

@ -152,6 +152,8 @@ namespace chat {
this.handle.handle.fileManager.icons.generateTag(server.properties.virtualserver_icon_id).appendTo(html_tag);
$.spawn("div").text(server.properties.virtualserver_name).appendTo(html_tag);
html_tag_title.text(tr("You're chatting in Server"));
this.update_server_limit(server, html_limit_tag);
} else if(this.handle.handle.connected) {
$.spawn("div").text("No channel selected").appendTo(html_tag);
} else {
@ -177,6 +179,18 @@ namespace chat {
tag.text(channel.clients(false).length + " / " + channel_limit);
}
private update_server_limit(server: ServerEntry, tag: JQuery) {
const fn = () => {
let text = server.properties.virtualserver_clientsonline + " / " + server.properties.virtualserver_maxclients;
if(server.properties.virtualserver_reserved_slots)
text += " (" + server.properties.virtualserver_reserved_slots + " " + tr("Reserved") + ")";
tag.text(text);
};
server.updateProperties().then(fn).catch(error => tag.text(tr("Failed to update info")));
fn();
}
update_chat_counter() {
const conversations = this.handle.private_conversations().conversations();
{