Name the server and channel chat tabs after where we are

Both carry an icon now, as the private chats do.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 06:57:38 +00:00
parent 966f3fe9b1
commit 8e3e9401d2
3 changed files with 56 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
package com.ts3client.ui;
import com.ts3client.net.ChannelNode;
import com.ts3client.net.ClientEntry;
import com.ts3client.net.ConnectionListener;
import com.ts3client.net.TeamspeakConnection;
@@ -50,6 +52,14 @@ final class ServerTabConnectionEvents implements ConnectionListener {
this.treeActions = treeActions;
}
/** Name of the channel we are in, or null while that is not known yet. */
private String currentChannelName() {
ClientEntry self = conn.getModel().getClient(conn.getSelfClientId());
if (self == null) return null;
ChannelNode ch = conn.getModel().getChannel(self.channelId);
return ch == null ? null : ch.name;
}
@Override
public void onStatus(String text) {
SwingUtilities.invokeLater(() -> {
@@ -80,6 +90,8 @@ final class ServerTabConnectionEvents implements ConnectionListener {
chatPanel.setInputEnabled(false);
chatPanel.closePrivateChats();
chatPanel.closeNoteTabs();
chatPanel.setServerName(null);
chatPanel.setChannelName(null);
chatPanel.appendSystem("Disconnected" + (reason == null || reason.isEmpty() ? "." : ": " + reason));
host.tabDisconnected(tab);
});
@@ -96,6 +108,10 @@ final class ServerTabConnectionEvents implements ConnectionListener {
listener.setTitle(name);
host.tabUpdated(tab);
}
if (conn.isConnected()) {
chatPanel.setServerName(name);
chatPanel.setChannelName(currentChannelName());
}
});
}