Fixed query visibility setting

This commit is contained in:
WolverinDEV 2019-02-17 12:51:42 +01:00
parent 525d2ceb29
commit fea3819024
4 changed files with 100 additions and 92 deletions

View file

@ -7,6 +7,7 @@
- Improved error handling within the codecs - Improved error handling within the codecs
- Fixed the vertical sliders for touch devices - Fixed the vertical sliders for touch devices
- Added an effect on slider select/move - Added an effect on slider select/move
- Fixed query visibility setting
* **15.02.19** * **15.02.19**
- Fixed MS Edge loading/document issues - Fixed MS Edge loading/document issues

View file

@ -907,48 +907,52 @@ class ConnectionCommandHandler {
} else { } else {
client = new ClientEntry(parseInt(json["clid"]), json["client_nickname"]); client = new ClientEntry(parseInt(json["clid"]), json["client_nickname"]);
} }
client.properties.client_type = parseInt(json["client_type"]);
client = tree.insertClient(client, channel); client = tree.insertClient(client, channel);
} else { } else {
if(client == this.connection._client.getClient()) if(client == this.connection._client.getClient())
chat.channelChat().name = channel.channelName(); chat.channelChat().name = channel.channelName();
tree.moveClient(client, channel); tree.moveClient(client, channel);
} }
const own_channel = this.connection._client.getClient().currentChannel();
if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) { if(this.connection._client.controlBar.query_visible || client.properties.client_type != ClientType.CLIENT_QUERY) {
if(own_channel == channel) const own_channel = this.connection._client.getClient().currentChannel();
if(old_channel) if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) {
sound.play(Sound.USER_ENTERED); if(own_channel == channel)
else if(old_channel)
sound.play(Sound.USER_ENTERED_CONNECT); sound.play(Sound.USER_ENTERED);
if(old_channel) { else
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}"), true, client.createChatTag(true), old_channel.generate_tag(true), channel.generate_tag(true)); sound.play(Sound.USER_ENTERED_CONNECT);
if(old_channel) {
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}"), true, client.createChatTag(true), old_channel.generate_tag(true), channel.generate_tag(true));
} else {
chat.serverChat().appendMessage(tr("{0} connected to channel {1}"), true, client.createChatTag(true), channel.generate_tag(true));
}
} else if(json["reasonid"] == ViewReasonId.VREASON_MOVED) {
if(own_channel == channel)
sound.play(Sound.USER_ENTERED_MOVED);
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}, moved by {3}"), true,
client.createChatTag(true),
old_channel ? old_channel.generate_tag(true) : undefined,
channel.generate_tag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
);
} else if(json["reasonid"] == ViewReasonId.VREASON_CHANNEL_KICK) {
if(own_channel == channel)
sound.play(Sound.USER_ENTERED_KICKED);
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}, kicked by {3}{4}"), true,
client.createChatTag(true),
old_channel ? old_channel.generate_tag(true) : undefined,
channel.generate_tag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
json["reasonmsg"] > 0 ? " (" + json["msg"] + ")" : ""
);
} else { } else {
chat.serverChat().appendMessage(tr("{0} connected to channel {1}"), true, client.createChatTag(true), channel.generate_tag(true)); console.warn(tr("Unknown reasonid for %o"), json["reasonid"]);
} }
} else if(json["reasonid"] == ViewReasonId.VREASON_MOVED) {
if(own_channel == channel)
sound.play(Sound.USER_ENTERED_MOVED);
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}, moved by {3}"), true,
client.createChatTag(true),
old_channel ? old_channel.generate_tag(true) : undefined,
channel.generate_tag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
);
} else if(json["reasonid"] == ViewReasonId.VREASON_CHANNEL_KICK) {
if(own_channel == channel)
sound.play(Sound.USER_ENTERED_KICKED);
chat.serverChat().appendMessage(tr("{0} appeared from {1} to {2}, kicked by {3}{4}"), true,
client.createChatTag(true),
old_channel ? old_channel.generate_tag(true) : undefined,
channel.generate_tag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
json["reasonmsg"] > 0 ? " (" + json["msg"] + ")" : ""
);
} else {
console.warn(tr("Unknown reasonid for %o"), json["reasonid"]);
} }
let updates: { let updates: {
@ -995,58 +999,59 @@ class ConnectionCommandHandler {
return; return;
} }
const own_channel = this.connection._client.getClient().currentChannel(); if(this.connection._client.controlBar.query_visible || client.properties.client_type != ClientType.CLIENT_QUERY) {
let channel_from = tree.findChannel(json["cfid"]); const own_channel = this.connection._client.getClient().currentChannel();
let channel_to = tree.findChannel(json["ctid"]); let channel_from = tree.findChannel(json["cfid"]);
let channel_to = tree.findChannel(json["ctid"]);
if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) {
chat.serverChat().appendMessage(tr("{0} disappeared from {1} to {2}"), true, client.createChatTag(true), channel_from.generate_tag(true), channel_to.generate_tag(true));
if(json["reasonid"] == ViewReasonId.VREASON_USER_ACTION) { if(channel_from == own_channel)
chat.serverChat().appendMessage(tr("{0} disappeared from {1} to {2}"), true, client.createChatTag(true), channel_from.generate_tag(true), channel_to.generate_tag(true)); sound.play(Sound.USER_LEFT);
} else if(json["reasonid"] == ViewReasonId.VREASON_SERVER_LEFT) {
chat.serverChat().appendMessage(tr("{0} left the server{1}"), true,
client.createChatTag(true),
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : ""
);
if(channel_from == own_channel) if(channel_from == own_channel)
sound.play(Sound.USER_LEFT); sound.play(Sound.USER_LEFT_DISCONNECT);
} else if(json["reasonid"] == ViewReasonId.VREASON_SERVER_LEFT) { } else if(json["reasonid"] == ViewReasonId.VREASON_SERVER_KICK) {
chat.serverChat().appendMessage(tr("{0} left the server{1}"), true, chat.serverChat().appendError(tr("{0} was kicked from the server by {1}.{2}"),
client.createChatTag(true), client.createChatTag(true),
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : "" ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
); json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : ""
);
if(channel_from == own_channel)
sound.play(Sound.USER_LEFT_KICKED_SERVER);
} else if(json["reasonid"] == ViewReasonId.VREASON_CHANNEL_KICK) {
chat.serverChat().appendError(tr("{0} was kicked from your channel by {1}.{2}"),
client.createChatTag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : ""
);
if(channel_from == own_channel) if(channel_from == own_channel)
sound.play(Sound.USER_LEFT_DISCONNECT); sound.play(Sound.USER_LEFT_KICKED_CHANNEL);
} else if(json["reasonid"] == ViewReasonId.VREASON_SERVER_KICK) { } else if(json["reasonid"] == ViewReasonId.VREASON_BAN) {
chat.serverChat().appendError(tr("{0} was kicked from the server by {1}.{2}"), //"Mulus" was banned for 1 second from the server by "WolverinDEV" (Sry brauchte kurz ein opfer :P <3 (Nohomo))
client.createChatTag(true), let duration = "permanently";
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]), if(json["bantime"])
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : "" duration = "for " + formatDate(Number.parseInt(json["bantime"]));
);
if(channel_from == own_channel)
sound.play(Sound.USER_LEFT_KICKED_SERVER);
} else if(json["reasonid"] == ViewReasonId.VREASON_CHANNEL_KICK) {
chat.serverChat().appendError(tr("{0} was kicked from your channel by {1}.{2}"),
client.createChatTag(true),
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : ""
);
if(channel_from == own_channel) chat.serverChat().appendError(tr("{0} was banned {1} by {2}.{3}"),
sound.play(Sound.USER_LEFT_KICKED_CHANNEL); client.createChatTag(true),
} else if(json["reasonid"] == ViewReasonId.VREASON_BAN) { duration,
//"Mulus" was banned for 1 second from the server by "WolverinDEV" (Sry brauchte kurz ein opfer :P <3 (Nohomo)) ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]),
let duration = "permanently"; json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : ""
if(json["bantime"]) );
duration = "for " + formatDate(Number.parseInt(json["bantime"]));
chat.serverChat().appendError(tr("{0} was banned {1} by {2}.{3}"), if(channel_from == own_channel)
client.createChatTag(true), sound.play(Sound.USER_LEFT_BANNED);
duration, } else {
ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"]), console.error(tr("Unknown client left reason!"));
json["reasonmsg"] ? " (" + json["reasonmsg"] + ")" : "" }
);
if(channel_from == own_channel)
sound.play(Sound.USER_LEFT_BANNED);
} else {
console.error(tr("Unknown client left reason!"));
} }
tree.deleteClient(client); tree.deleteClient(client);

View file

@ -96,9 +96,9 @@ class ControlBar {
} }
//Need an initialise //Need an initialise
this.muteInput = settings.global("mute_input") == "1"; this.muteInput = settings.static_global("mute_input", false);
this.muteOutput = settings.global("mute_output") == "1"; this.muteOutput = settings.static_global("mute_output", false);
this.query_visibility = settings.global("show_server_queries") == "1"; this.query_visible = settings.static_global("show_server_queries", false);
} }
@ -412,21 +412,22 @@ class ControlBar {
Modals.spawnBookmarkModal(); Modals.spawnBookmarkModal();
} }
get query_visibility() { get query_visible() {
return this._query_visible; return this._query_visible;
} }
set query_visibility(flag: boolean) { set query_visible(flag: boolean) {
console.error(flag);
if(this._query_visible == flag) return; if(this._query_visible == flag) return;
this._query_visible = flag; this._query_visible = flag;
settings.global("show_server_queries", flag); settings.changeGlobal("show_server_queries", flag);
this.update_query_visibility_button(); this.update_query_visibility_button();
this.handle.channelTree.toggle_server_queries(flag); this.handle.channelTree.toggle_server_queries(flag);
} }
private on_query_visibility_toggle() { private on_query_visibility_toggle() {
this.query_visibility = !this._query_visible; this.query_visible = !this._query_visible;
this.update_query_visibility_button(); this.update_query_visibility_button();
} }

View file

@ -295,15 +295,17 @@ class ChannelTree {
else else
this.clients.push(client); this.clients.push(client);
if(!this._show_queries && client.properties.client_type == ClientType.CLIENT_QUERY)
client.tag.hide();
client.channelTree = this; client.channelTree = this;
client["_channel"] = channel; client["_channel"] = channel;
let tag = client.tag; let tag = client.tag;
if(!this._tree_detached)
tag.css({display: "none"}).fadeIn("slow");
if(!this._show_queries && client.properties.client_type == ClientType.CLIENT_QUERY)
client.tag.hide();
else if(!this._tree_detached)
tag.css("display", "none").fadeIn("slow");
tag.appendTo(channel.clientTag()); tag.appendTo(channel.clientTag());
client.currentChannel().reorderClients(); client.currentChannel().reorderClients();
@ -730,7 +732,6 @@ class ChannelTree {
if(this._show_queries == flag) return; if(this._show_queries == flag) return;
this._show_queries = flag; this._show_queries = flag;
//FIXME resize channels
const channels: ChannelEntry[] = [] const channels: ChannelEntry[] = []
for(const client of this.clients) for(const client of this.clients)
if(client.properties.client_type == ClientType.CLIENT_QUERY) { if(client.properties.client_type == ClientType.CLIENT_QUERY) {