Log our own channel switches in the server tab

Every other client's move was logged; ours went by silently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 06:57:23 +00:00
parent b85d1e5076
commit 966f3fe9b1

View File

@@ -76,6 +76,7 @@ final class ConnectionEventHandler implements TS3Listener {
c.channelId = e.getTargetChannelId(); c.channelId = e.getTargetChannelId();
if (e.getClientId() == conn.getSelfClientId()) { if (e.getClientId() == conn.getSelfClientId()) {
announceOwnMove(safeInt(e, "reasonid"), e); announceOwnMove(safeInt(e, "reasonid"), e);
logOwnMove(e, from, e.getTargetChannelId());
} else { } else {
announceClientMoved(safeInt(e, "reasonid"), e.getClientId(), from, e.getTargetChannelId()); announceClientMoved(safeInt(e, "reasonid"), e.getClientId(), from, e.getTargetChannelId());
logClientMoved(e, conn.clientLink(c.id), from, e.getTargetChannelId()); logClientMoved(e, conn.clientLink(c.id), from, e.getTargetChannelId());
@@ -153,6 +154,25 @@ final class ConnectionEventHandler implements TS3Listener {
} }
} }
/** Our own move between channels, logged the way TS3 does for everyone else. */
private void logOwnMove(ClientMovedEvent e, int fromChannel, int toChannel) {
String reasonMsg = TeamspeakConnection.orEmpty(e.get("reasonmsg"));
String suffix = reasonMsg.isEmpty() ? "" : " (" + reasonMsg + ")";
switch (safeInt(e, "reasonid")) {
case REASON_MOVED:
conn.log("You were moved from channel \"" + conn.channelLink(fromChannel) + "\" to \""
+ conn.channelLink(toChannel) + "\" by " + invokerName(e));
break;
case REASON_CHANNEL_KICK:
conn.log("You were kicked from channel \"" + conn.channelLink(fromChannel) + "\" to \""
+ conn.channelLink(toChannel) + "\" by " + invokerName(e) + suffix);
break;
default:
conn.log("You switched from channel \"" + conn.channelLink(fromChannel) + "\" to \""
+ conn.channelLink(toChannel) + "\"");
}
}
/** /**
* A client became visible: either they just connected, or they moved in from a * A client became visible: either they just connected, or they moved in from a
* channel we could not see — TeamSpeak's "appears" case. * channel we could not see — TeamSpeak's "appears" case.