Stop the channel list from clearing channel icons
The channellist command answers with a narrower field set than the events the server pushes while connecting, so reconciling against it wiped the icon ids those events had just delivered — leaving pre-existing channel icons invisible while a live icon change still showed up. Treat a missing or blank icon there as "not reported" rather than "no icon"; only the edit event, which lists exactly what changed, may clear one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,10 +316,11 @@ public final class TeamspeakConnection implements TS3Listener {
|
|||||||
node.permanent = ch.isPermanent();
|
node.permanent = ch.isPermanent();
|
||||||
node.topic = ch.getTopic() == null ? "" : ch.getTopic();
|
node.topic = ch.getTopic() == null ? "" : ch.getTopic();
|
||||||
node.maxClients = ch.getMaxClients();
|
node.maxClients = ch.getMaxClients();
|
||||||
// channellist omits the icon on some servers; keep what events gave us.
|
// The channellist command answers with a narrower field set than the
|
||||||
if (ch.get("channel_icon_id") != null) {
|
// events do, so a missing (or blank) icon here means "not reported",
|
||||||
node.iconId = safeLong(ch.get("channel_icon_id"));
|
// not "no icon" — never let it clear what the events delivered.
|
||||||
}
|
long icon = safeLong(ch.get("channel_icon_id"));
|
||||||
|
if (icon != 0) node.iconId = icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -612,7 +613,8 @@ public final class TeamspeakConnection implements TS3Listener {
|
|||||||
if (pid == 0) pid = safeInt(e, "pid");
|
if (pid == 0) pid = safeInt(e, "pid");
|
||||||
int order = safeInt(e, "channel_order");
|
int order = safeInt(e, "channel_order");
|
||||||
ChannelNode node = model.putChannel(cid, name, pid, order);
|
ChannelNode node = model.putChannel(cid, name, pid, order);
|
||||||
node.iconId = safeLong(e, "channel_icon_id");
|
long icon = safeLong(e, "channel_icon_id");
|
||||||
|
if (icon != 0) node.iconId = icon;
|
||||||
model.relinkChannel(cid, pid, order);
|
model.relinkChannel(cid, pid, order);
|
||||||
ui.onModelChanged();
|
ui.onModelChanged();
|
||||||
}
|
}
|
||||||
@@ -653,7 +655,9 @@ public final class TeamspeakConnection implements TS3Listener {
|
|||||||
String name = e.get("channel_name");
|
String name = e.get("channel_name");
|
||||||
int pid = safeInt(e, "cpid");
|
int pid = safeInt(e, "cpid");
|
||||||
int order = safeInt(e, "channel_order");
|
int order = safeInt(e, "channel_order");
|
||||||
model.putChannel(cid, name, pid, order).iconId = safeLong(e, "channel_icon_id");
|
ChannelNode node = model.putChannel(cid, name, pid, order);
|
||||||
|
long icon = safeLong(e, "channel_icon_id");
|
||||||
|
if (icon != 0) node.iconId = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user