session.connection() is gone: the session hands out the model, our ids, the microphone and speakers, ping and connection info, the server's unique id, icon and avatar stores, myTeamSpeak, the connect error and a blocking disconnectNow. The connection's remaining actions move into helpers the session hands out instead of forwarding each method: ClientAdmin (move, kick, ban, groups, talk power, poke, client details), ChannelFiles (listing, mkdir, rename, delete, transfers and their sounds) and ClientContacts (display names, volume, auto-mute, whisper policy, sightings); ChannelAdmin also takes join, move, subscribe and description requests. Dialogs take the session instead of the connection. Android's network handover now uses disconnectNow, which also cancels a pending auto-reconnect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
4.9 KiB
Markdown
29 lines
4.9 KiB
Markdown
# Structural audit — ts3-client and Android
|
|
|
|
Audit: 2026-10-11. Design and maintainability (DRY, SOLID, separation of concerns); the
|
|
correctness audit is [AUDIT.md](AUDIT.md). Not reviewed: the audio/DSP packages, tray/X11,
|
|
D-Bus and the ts3j submodule.
|
|
|
|
Items are worked through in the order below. Status: open, done (commit), or closed (reason).
|
|
|
|
| # | Finding | Status |
|
|
|---|---|---|
|
|
| 1 | Request failures reach frontends as strings, so they guess the kind by substring (`BanListDialog`, `ServerLogDialog`) and core needs a sentinel message (`SEARCH_NOT_PERMITTED`); success is signalled by a `null` error, here and in Android's `ServerController` (`String?`) | done (`0552ed8`): requests return `CompletableFuture`, failing with `RequestException` (kind + message); `Replies`/`Edt` split success and failure; Android uses `Result` |
|
|
| 2 | Client properties parsed twice: `ConnectionEventHandler.onClientJoin` sets every field, `onClientChanged` the same ones again; channels already share `applyChannelProperties` | done (`e255a46`): one `applyClientProperties`. It also fixed a joining channel commander shown as none, and picks up the description a client enters with |
|
|
| 3 | What we may do is answered in five places: `ServerSession.can*`, `ServerModel.can*/permits/mayHavePower`, `TeamspeakConnection.canSendOfflineMessages/canTransferFiles`, and raw permission names in Swing dialogs and `ServerController.canCreateBans` | done (`13e3a62`): `Permissions` owns the table, the rules and one named question per capability; `ServerSession.permissions()` is `NONE` while disconnected; no permission names outside core except channel-permission editing |
|
|
| 4 | `TeamspeakConnection` (2,157 lines) still does lifecycle, mic/speaker, recording, chat logs, log/sound text, contacts, avatars, icons, file transfers, myTeamSpeak and job plumbing. The `*Admin` helpers take the whole connection, which forwards ~90 methods to them | in progress, in sub-steps: |
|
|
| 4a | … chat log and what we tell the user (log lines, sounds, links and sound variables) | done (`1bc7eb5`): `ChatLog`, `Announcer` |
|
|
| 4b | … request plumbing into its own class; `*Admin` helpers on narrow dependencies instead of the whole connection | done (`da908f7`; renamed `Uplink` in 4c, as `session.ServerLink` is the `ts3server://` link): `ServerLink` owns the socket, event and request threads and file transfers, and runs requests; the helpers take it (plus the model, permissions or avatars where they need them) |
|
|
| 4c | … frontends reach the admin helpers directly instead of ~40 one-line forwarders | done (`959f7ed`): the helpers are public with non-blocking methods, reached through `ServerSession`/`TeamspeakConnection` getters; 30 forwarders gone, and what they added (stop-at-first-refusal loops, log lines, description refresh, own avatar flag) moved into the helpers. Swing dialogs still take the whole connection for the model and our ids (item 5) |
|
|
| 4d | … our own state (mic, speakers, away, talk request, recording) out of the connection | done (`9107bdd`): `OwnClient` owns the devices and our flags, and publishes them; `Recording` the recorder. `ServerSession` no longer keeps its own copy of the flags, and they are cleared when a connect starts rather than once it is done |
|
|
| 5 | Two front doors: frontends use both `ServerSession` and `session.connection()` with no rule for which | done (uncommitted): `connection()` is gone; frontends reach the model, our ids, devices and the helpers through `ServerSession`. New helpers took the remaining actions off the connection: `ClientAdmin` (move, kick, ban, groups, talk power, poke, details), `ChannelFiles`, `ClientContacts`; `ChannelAdmin` also joins, moves and subscribes. Dialogs take the session, or only the helper they use |
|
|
| 6 | Menu bar, toolbar and hotkeys each implement the same commands: `MainMenuBar.Listener` (~50 methods, ~210 lines of forwarding in `MainFrame`), `MainToolbar.Listener`, `HotkeyActions` | open |
|
|
| 7 | The admin list dialogs (bans, complaints, offline messages, privilege keys, server log) repeat the load/status/table-model scaffolding | open |
|
|
| 8 | `Settings`: 58 public fields, each key spelled twice (load and save), no change notification, so callers fan changes out by hand | open |
|
|
| 9 | Duplicates: three byte-size formatters (`FileBrowserDialog`, `ChatHtml`, `ConnectionStatsFormat`); four "which chat" enums (`ChatScope`, `ChatLogScope`, `ChatPanel.Target`, Android `ChatKey`); the conversation model lives in each frontend | open |
|
|
| 10 | Android `ServerScreen`: one 456-line composable holding ~25 pieces of state | open |
|
|
| 11 | Android `SessionController` (669 lines) is the app-wide view model and service locator; every screen gets all of it | open |
|
|
| 12 | Swing `ui` package: 118 files, flat | open |
|
|
| 13 | `ClientEntry`/`ChannelNode` are bags of public volatile fields; a reader can see a half-applied update | open |
|
|
| 14 | Core produces English UI copy (status lines, log lines) | open |
|