From 25a78f52fe9ce142ff25ee48cf65864200392d88 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Fri, 14 Aug 2026 12:46:55 +0000 Subject: [PATCH] Show our own mute, away and commander state right away The server sends notifyclientupdated to the other clients only, so a clientupdate of our own never came back to us and our row in the tree kept its old icons until something else refreshed it. Apply the change to the local model as we send it. Co-Authored-By: Claude Opus 5 --- .../ts3client/net/TeamspeakConnection.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ts3-client/core/src/main/java/com/ts3client/net/TeamspeakConnection.java b/ts3-client/core/src/main/java/com/ts3client/net/TeamspeakConnection.java index 9cbc77a..c6107a0 100644 --- a/ts3-client/core/src/main/java/com/ts3client/net/TeamspeakConnection.java +++ b/ts3-client/core/src/main/java/com/ts3client/net/TeamspeakConnection.java @@ -472,8 +472,16 @@ public final class TeamspeakConnection implements TS3Listener { } private void pushSelfFlags() { + if (microphone == null || playback == null) return; + boolean micMuted = microphone.isMuted(); + boolean deaf = playback.isDeafened(); + updateSelf(self -> { + self.inputMuted = micMuted; + self.outputMuted = deaf; + }); + // Best-effort: publish input/output muted flags to the server so others see them. - if (client == null || !connected || microphone == null || playback == null) return; + if (client == null || !connected) return; try { java.util.Map props = new java.util.HashMap<>(); props.put("client_input_muted", microphone.isMuted() ? "1" : "0"); @@ -573,6 +581,7 @@ public final class TeamspeakConnection implements TS3Listener { public void setAway(boolean away, String message) { sound(away ? SoundEvent.STATUS_SET_AWAY : SoundEvent.STATUS_SET_PRESENT); + updateSelf(self -> self.away = away); selfUpdate(cmd -> { cmd.add(new CommandSingleParameter("client_away", away ? "1" : "0")); cmd.add(new CommandSingleParameter("client_away_message", away && message != null ? message : "")); @@ -580,11 +589,24 @@ public final class TeamspeakConnection implements TS3Listener { } public void setChannelCommander(boolean commander) { + updateSelf(self -> self.channelCommander = commander); selfUpdate(cmd -> cmd.add(new CommandSingleParameter("client_is_channel_commander", commander ? "1" : "0")), "Channel commander update failed"); } + /** + * Applies a change of our own state to the local model. The server sends + * {@code notifyclientupdated} to the other clients only, so without this + * our own row would keep its old icons until something else refreshed it. + */ + private void updateSelf(java.util.function.Consumer change) { + ClientEntry self = model.getClient(selfClientId); + if (self == null) return; + change.accept(self); + ui.onModelChanged(); + } + /** Sends a {@code clientupdate} for the local client on a background thread. */ private void selfUpdate(java.util.function.Consumer fill, String errorLabel) { new Thread(() -> {