chore: comment cleanup pass ahead of open-sourcing
Some checks failed
Build Linux Binaries / linux/amd64 (push) Has been cancelled
Build Linux Binaries / linux/arm64 (push) Has been cancelled

Removes leftover debug scaffolding (stray Console.WriteLine/NSLog traces,
dead nick_buf_ptr, a no-op --print-config flag now implemented for real),
fixes stale/misleading comments (channel passwords are no longer a "future
M5+" feature, a wrong cross-reference, a stale TlsContext::close() mention,
an incomplete BanRecord::subject_type doc, and a smoke test pointing at a
build/m1-dev preset that no longer exists), strips internal M1-M5 milestone
jargon from comments now that the roadmap is done, trims comments that just
restated the following line, and consolidates a few "why" explanations that
were duplicated 2-3 times in the same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 10:20:18 +01:00
parent bda37ec27b
commit bba605401d
50 changed files with 229 additions and 331 deletions

View File

@@ -54,11 +54,11 @@ final class SessionState {
var accounts: [Account] = []
var devices: [Device] = []
/// Back-reference to the app state. Once `SessionState.init` overwrites `client.onEvent`
/// (`SessionState.swift:87`), `AppState.handleConnectEvent` no longer receives per-session
/// events so the `.disconnected` event for a LIVE session arrives here in `handleEvent`,
/// not in AppState. This weak ref lets us hand the disconnect back to AppState (which owns
/// the reconnect state machine) so the auto-reconnect fires. Set by AppState on auth success.
/// Back-reference to the app state. Once `SessionState.init` overwrites `client.onEvent`,
/// `AppState.handleConnectEvent` no longer receives per-session events so the
/// `.disconnected` event for a LIVE session arrives here in `handleEvent`, not in AppState.
/// This weak ref lets us hand the disconnect back to AppState (which owns the reconnect
/// state machine) so the auto-reconnect fires. Set by AppState on auth success.
weak var appState: AppState?
// MARK: - Reconnect restore state
@@ -260,17 +260,18 @@ final class SessionState {
// MARK: - Self-channel / server-mute sync
/// Sync currentChannelId from the self user's channelId in the user list. Mirrors macOS
/// MainWindowController.swift:461,491,522. The server auto-places every authed user into
/// the Lobby (channel 1) on connect, but without this sync currentChannelId stays 0 and
/// the mic button (gated on currentChannelId == 0) stays permanently dimmed.
/// MainWindowController's bootstrap/event-handling sync. The server auto-places every
/// authed user into the Lobby (channel 1) on connect, but without this sync
/// currentChannelId stays 0 and the mic button (gated on currentChannelId == 0) stays
/// permanently dimmed.
private func syncSelfChannel() {
if let me = users.first(where: { $0.id == selfUserId }) {
currentChannelId = me.channelId
}
}
/// Apply server-side mute/deafen state mirrors macOS MainWindowController.swift:693-700.
/// iOS was previously ignoring server mute/deafen entirely.
/// Apply server-side mute/deafen state mirrors macOS MainWindowController's handling
/// of UserEvent.UPDATED for the self user.
private func applyServerMuteState(muted: Bool, deafened: Bool) {
if muted && !voiceState.serverMuted { addActivity("You have been server-muted") }
if deafened && !voiceState.serverDeafened { addActivity("You have been server-deafened") }