Connect a left-clicked bookmark on the current tab
Middle-click still opens the server in a new tab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -230,6 +230,24 @@ final class ServerTab implements ServerTabConnectionEvents.Listener {
|
||||
}, "identity-resolve").start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces this tab's connection: leaves the server it is on, then connects to the
|
||||
* new one in its place — what left-clicking a bookmark does.
|
||||
*/
|
||||
void switchTo(String address, int port, String nickname, String password, String identityId,
|
||||
String channel, String channelPassword) {
|
||||
if (!isBusy()) {
|
||||
connect(address, port, nickname, password, identityId, channel, channelPassword);
|
||||
return;
|
||||
}
|
||||
new Thread(() -> {
|
||||
conn.disconnectBlocking("Switching servers");
|
||||
// Queued behind the disconnect's own UI work, which clears the "connecting" flag.
|
||||
SwingUtilities.invokeLater(() ->
|
||||
connect(address, port, nickname, password, identityId, channel, channelPassword));
|
||||
}, "ts3j-switch-server").start();
|
||||
}
|
||||
|
||||
void disconnect() {
|
||||
if (conn.isConnected()) conn.disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user