myTeamSpeak: announce the account ID to servers
Signs clientinit with the account's Ed25519 key over the connection challenge, honours the per-bookmark switch, sends updatemytsid on sign-in/out, and connects without the ID when myTeamSpeak is unreachable. Verified live against server.lixko.eu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,8 @@ public final class ConnectDialog extends JDialog {
|
||||
private final JTextField nickField;
|
||||
private final JPasswordField passwordField;
|
||||
private final IdentityChooser identityChooser;
|
||||
private final javax.swing.JCheckBox myTeamSpeakFeatures =
|
||||
new javax.swing.JCheckBox("Enable myTeamSpeak features", true);
|
||||
|
||||
private boolean confirmed;
|
||||
|
||||
@@ -62,6 +64,7 @@ public final class ConnectDialog extends JDialog {
|
||||
add(form, c, row++, "Nickname:", nickField);
|
||||
add(form, c, row++, "Password (optional):", passwordField);
|
||||
add(form, c, row++, "Identity:", identityChooser);
|
||||
add(form, c, row++, "", myTeamSpeakFeatures);
|
||||
|
||||
JPanel buttons = new JPanel(new BorderLayout());
|
||||
JPanel right = new JPanel();
|
||||
@@ -102,6 +105,10 @@ public final class ConnectDialog extends JDialog {
|
||||
return confirmed;
|
||||
}
|
||||
|
||||
public boolean isMyTeamSpeakFeaturesEnabled() {
|
||||
return myTeamSpeakFeatures.isSelected();
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return addressField.getText().trim();
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
dlg.setVisible(true);
|
||||
if (!dlg.isConfirmed()) return;
|
||||
startConnection(dlg.getAddress(), dlg.getPort(), dlg.getNickname(), dlg.getPassword(),
|
||||
dlg.getIdentityId(), "", "");
|
||||
dlg.getIdentityId(), "", "", false, dlg.isMyTeamSpeakFeaturesEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -811,12 +811,18 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
*/
|
||||
private void startConnection(String address, int port, String nickname, String password, String identityId,
|
||||
String channel, String channelPassword, boolean replaceCurrent) {
|
||||
startConnection(address, port, nickname, password, identityId, channel, channelPassword, replaceCurrent, true);
|
||||
}
|
||||
|
||||
private void startConnection(String address, int port, String nickname, String password, String identityId,
|
||||
String channel, String channelPassword, boolean replaceCurrent, boolean mytsFeatures) {
|
||||
settings.lastAddress = address + ":" + port;
|
||||
if (!nickname.isBlank()) settings.nickname = nickname;
|
||||
settings.serverPassword = password;
|
||||
settings.save();
|
||||
|
||||
ServerTab tab = (replaceCurrent && selected != null) ? selected : tabForNewConnection();
|
||||
tab.session().connection().setMyTeamSpeakFeatures(mytsFeatures);
|
||||
// The first connection to come up takes the microphone; later ones are muted
|
||||
// until the user activates them.
|
||||
if (sessions.microphoneOwner() == null) sessions.giveMicrophoneTo(tab.session());
|
||||
@@ -846,13 +852,14 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
}
|
||||
}
|
||||
ServerTab tab = tabForNewConnection();
|
||||
tab.session().connection().setMyTeamSpeakFeatures(true);
|
||||
if (sessions.microphoneOwner() == null) sessions.giveMicrophoneTo(tab.session());
|
||||
tab.session().open(link, "");
|
||||
}
|
||||
|
||||
/** Connects on the current tab, leaving whatever server it is on. */
|
||||
private void connectToBookmark(Bookmark b) {
|
||||
startConnection(b.address, b.port, b.nickname == null ? "" : b.nickname, b.password, b.identityId, b.channel, b.channelPassword, true);
|
||||
startConnection(b.address, b.port, b.nickname == null ? "" : b.nickname, b.password, b.identityId, b.channel, b.channelPassword, true, b.myTeamSpeakFeatures);
|
||||
}
|
||||
|
||||
private void addCurrentServerBookmark() {
|
||||
@@ -1035,7 +1042,10 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
/** Signed in to or out of myTeamSpeak: sharing in chat follows. */
|
||||
private void myTeamSpeakChanged() {
|
||||
boolean signedIn = myTeamSpeak.isSignedIn();
|
||||
for (ServerTab tab : tabs) tab.chat().setSharingAvailable(signedIn);
|
||||
for (ServerTab tab : tabs) {
|
||||
tab.chat().setSharingAvailable(signedIn);
|
||||
tab.session().connection().updateMyTeamSpeak();
|
||||
}
|
||||
if (signedIn) {
|
||||
pictures.retryFailed();
|
||||
} else {
|
||||
@@ -1047,6 +1057,10 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
MyTeamSpeakLogin myTeamSpeakLogin() {
|
||||
return myTeamSpeak;
|
||||
}
|
||||
|
||||
/** Whether files can be shared in chat: that needs a myTeamSpeak account. */
|
||||
boolean canShareFiles() {
|
||||
return myTeamSpeak.isSignedIn();
|
||||
|
||||
@@ -78,6 +78,7 @@ final class ServerTab {
|
||||
ServerTabConnectionEvents events = new ServerTabConnectionEvents(host, this, settings);
|
||||
this.session = new ServerSession(settings, identities, audio, sounds, contacts, events);
|
||||
this.conn = session.connection();
|
||||
this.conn.setMyTeamSpeakLogin(host.myTeamSpeakLogin());
|
||||
this.groupIcons = new GroupIcons(conn.getIcons());
|
||||
this.chatPanel = new ChatPanel(host.chatZoom(), settings, pictures, conn::serverUniqueId);
|
||||
this.treeActions = new ServerTabTreeActions(host, this, conn, chatPanel, infoPanel, groupIcons);
|
||||
|
||||
Reference in New Issue
Block a user