From bcc034e97501eda9c936941049b8de36a85603ae Mon Sep 17 00:00:00 2001 From: ericek111 Date: Wed, 19 Aug 2026 17:38:53 +0000 Subject: [PATCH] Refresh a channel's cached description when it changes The description is fetched on demand and cached, but nothing invalidated it: notifychanneledited never carries the text, and the separate notifychanneldescriptionchanged was ignored. Handle that event, and refresh locally after our own edit, since the server does not notify the invoker. Co-Authored-By: Claude Opus 5 --- .../com/ts3client/net/ConnectionEventHandler.java | 14 ++++++++++++++ .../com/ts3client/net/TeamspeakConnection.java | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/ts3-client/core/src/main/java/com/ts3client/net/ConnectionEventHandler.java b/ts3-client/core/src/main/java/com/ts3client/net/ConnectionEventHandler.java index db5a301..5cf5787 100644 --- a/ts3-client/core/src/main/java/com/ts3client/net/ConnectionEventHandler.java +++ b/ts3-client/core/src/main/java/com/ts3client/net/ConnectionEventHandler.java @@ -365,6 +365,7 @@ final class ConnectionEventHandler implements TS3Listener { if (has(e, "channel_name")) ch.name = e.get("channel_name"); if (has(e, "channel_order")) ch.order = e.getInt("channel_order"); if (has(e, "channel_icon_id")) ch.iconId = TeamspeakConnection.safeLong(e, "channel_icon_id"); + if (has(e, "channel_topic")) ch.topic = e.get("channel_topic"); if (conn.isConnected()) { boolean current = conn.inOwnChannel(ch.id); conn.sound(current @@ -379,6 +380,19 @@ final class ConnectionEventHandler implements TS3Listener { } } + /** + * Descriptions never travel with the notify, so a cached one has to be re-fetched. + * Only channels whose description was already loaded are refreshed; the rest pick the + * new text up the first time they are looked at. + */ + @Override + public void onChannelDescriptionChanged(ChannelDescriptionEditedEvent e) { + ChannelNode ch = conn.getModel().getChannel(safeInt(e, "cid")); + if (ch == null || !ch.descriptionLoaded) return; + ch.descriptionLoaded = false; + conn.requestChannelInfo(ch.id); + } + @Override public void onChannelMoved(ChannelMovedEvent e) { ChannelNode ch = conn.getModel().getChannel(safeInt(e, "cid")); 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 e592a58..32f5702 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 @@ -919,6 +919,14 @@ public final class TeamspeakConnection implements TS3Listener { run("ts3j-channel-edit", (ignored, error) -> callback.accept(error), () -> { channels.edit(channelId, changes); channels.writePermissions(channelId, setPermissions, removePermissions); + if (changes.containsKey("channel_description")) { + ChannelNode node = model.getChannel(channelId); + // the server does not notify the invoker of their own description change + if (node != null && node.descriptionLoaded) { + node.descriptionLoaded = false; + requestChannelInfo(channelId); + } + } return null; }); }