chore: comment cleanup pass ahead of open-sourcing
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:
@@ -105,7 +105,6 @@ public sealed class ProcessAudioMixer : IDisposable
|
||||
for (int i = 0; i < frameLen; i++)
|
||||
{
|
||||
int sum = mix[i] + frame[i];
|
||||
// Saturating clamp
|
||||
mix[i] = (short)Math.Clamp(sum, short.MinValue, short.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,13 +92,8 @@ public partial class ConnectDialog : Form
|
||||
|
||||
private void BtnConnect_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine("[ConnectDialog] BtnConnect_Click fired");
|
||||
if (lstServers.SelectedItem is not SavedServer server)
|
||||
{
|
||||
Console.WriteLine("[ConnectDialog] no SavedServer selected — ignoring click");
|
||||
return;
|
||||
}
|
||||
Console.WriteLine($"[ConnectDialog] selected server: Host={server.Host} Port={server.Port} AuthMode={server.AuthMode}");
|
||||
try
|
||||
{
|
||||
StartConnect(server);
|
||||
@@ -121,21 +116,15 @@ public partial class ConnectDialog : Form
|
||||
: server.DisplayName;
|
||||
|
||||
string tofuDir = Path.GetDirectoryName(ServerListStore.TofuStorePath)!;
|
||||
Console.WriteLine($"[ConnectDialog] tofu store dir: {tofuDir}");
|
||||
Directory.CreateDirectory(tofuDir);
|
||||
|
||||
Console.WriteLine("[ConnectDialog] creating VoiceCatClient...");
|
||||
_client = new VoiceCatClient("VoiceCat-Windows", VoiceCatClient.VersionString,
|
||||
VcLogLevel.Info, ServerListStore.TofuStorePath);
|
||||
Console.WriteLine("[ConnectDialog] VoiceCatClient created OK");
|
||||
_client.EventReceived += OnEvent;
|
||||
_identityDialogShown = false;
|
||||
_pumpTimer.Start();
|
||||
Console.WriteLine($"[ConnectDialog] pump timer started, Enabled={_pumpTimer.Enabled}, Interval={_pumpTimer.Interval}");
|
||||
|
||||
Console.WriteLine($"[ConnectDialog] calling Connect({server.Host}, {server.Port})...");
|
||||
var connectResult = _client.Connect(server.Host, server.Port);
|
||||
Console.WriteLine($"[ConnectDialog] Connect() returned {connectResult}");
|
||||
if (connectResult != VcResult.Ok)
|
||||
{
|
||||
lblStatus.Text = $"Connect failed: {connectResult}";
|
||||
@@ -146,9 +135,7 @@ public partial class ConnectDialog : Form
|
||||
if (server.AuthMode == AuthMode.Guest)
|
||||
{
|
||||
Nickname = string.IsNullOrWhiteSpace(server.LastNickname) ? Environment.UserName : server.LastNickname;
|
||||
Console.WriteLine($"[ConnectDialog] calling AuthenticateGuest({Nickname})...");
|
||||
var authResult = _client.AuthenticateGuest(Nickname);
|
||||
Console.WriteLine($"[ConnectDialog] AuthenticateGuest() returned {authResult}");
|
||||
_client.AuthenticateGuest(Nickname);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,15 +156,12 @@ public partial class ConnectDialog : Form
|
||||
password = pwDlg.Password;
|
||||
}
|
||||
Nickname = server.SavedUsername ?? "";
|
||||
Console.WriteLine($"[ConnectDialog] calling AuthenticateUser({Nickname})...");
|
||||
var authResult = _client.AuthenticateUser(server.SavedUsername ?? "", password);
|
||||
Console.WriteLine($"[ConnectDialog] AuthenticateUser() returned {authResult}");
|
||||
_client.AuthenticateUser(server.SavedUsername ?? "", password);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEvent(VoiceCatEvent ev)
|
||||
{
|
||||
Console.WriteLine($"[ConnectDialog] event: {ev}");
|
||||
switch (ev.Type)
|
||||
{
|
||||
case VcEventType.ConnectionState:
|
||||
@@ -225,24 +209,18 @@ public partial class ConnectDialog : Form
|
||||
|
||||
private void HandleServerIdentity(VcTofuStatus status, string certFingerprintHex)
|
||||
{
|
||||
Console.WriteLine($"[ConnectDialog] HandleServerIdentity status={status} fp={certFingerprintHex} alreadyShown={_identityDialogShown}");
|
||||
if (_identityDialogShown) return; // one decision per connect attempt
|
||||
if (status == VcTofuStatus.Matched)
|
||||
{
|
||||
// Silent success path — no dialog. See ServerIdentityDialog's doc comment.
|
||||
Console.WriteLine("[ConnectDialog] status=Matched -> auto-confirming, no dialog");
|
||||
_client!.ConfirmServerIdentity(true);
|
||||
return;
|
||||
}
|
||||
|
||||
_identityDialogShown = true;
|
||||
Console.WriteLine("[ConnectDialog] showing ServerIdentityDialog...");
|
||||
using var dlg = new ServerIdentityDialog(status, certFingerprintHex, _client!.GetServerIdentityDisplay());
|
||||
var dlgResult = dlg.ShowDialog(this);
|
||||
Console.WriteLine($"[ConnectDialog] ServerIdentityDialog closed with {dlgResult}");
|
||||
bool accept = dlgResult == DialogResult.OK;
|
||||
var confirmResult = _client.ConfirmServerIdentity(accept);
|
||||
Console.WriteLine($"[ConnectDialog] ConfirmServerIdentity({accept}) returned {confirmResult}");
|
||||
bool accept = dlg.ShowDialog(this) == DialogResult.OK;
|
||||
_client.ConfirmServerIdentity(accept);
|
||||
if (!accept) lblStatus.Text = "Server identity rejected.";
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,7 +1114,7 @@ public partial class MainForm : Form
|
||||
OpenPmWindow(dlg.SelectedUserId);
|
||||
}
|
||||
|
||||
// ── M5: Moderation helpers ────────────────────────────────────────────────
|
||||
// ── Moderation helpers ─────────────────────────────────────────────────────
|
||||
|
||||
private void UpdateSelfServerMuteState(bool muted, bool deafened)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace VoiceCat.App.Forms;
|
||||
|
||||
/// <summary>Small modal for "type a password right now" — used when a saved server's
|
||||
/// password wasn't remembered, and (Phase E) for password-protected channel joins.</summary>
|
||||
/// password wasn't remembered, and for password-protected channel joins.</summary>
|
||||
public partial class PasswordPromptDialog : Form
|
||||
{
|
||||
public string Password => txtPassword.Text;
|
||||
|
||||
@@ -3,7 +3,7 @@ using VoiceCat.Interop;
|
||||
namespace VoiceCat.App.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// TOFU server-identity confirmation (M4). Shown only for VcTofuStatus.FirstConnect/Mismatch
|
||||
/// TOFU server-identity confirmation. Shown only for VcTofuStatus.FirstConnect/Mismatch
|
||||
/// — never Matched (that's the silent-success "subsequent connects verify the pin" path
|
||||
/// docs/security.md describes; showing a dialog on every routine reconnect would be exactly
|
||||
/// the "overly chatty" experience this project avoids elsewhere too).
|
||||
|
||||
@@ -7,17 +7,17 @@ namespace VoiceCat.App.Notifications;
|
||||
/// </summary>
|
||||
public enum SoundEvent
|
||||
{
|
||||
ChannelJoin, // another user joined my channel
|
||||
ChannelLeave, // another user left my channel
|
||||
ChannelJoin,
|
||||
ChannelLeave,
|
||||
ChannelRecv, // channel text message from someone else
|
||||
ChannelSent, // channel text message I sent
|
||||
PmRecv, // private message received
|
||||
PmSent, // private message I sent
|
||||
Login, // connected / authenticated
|
||||
Logout, // clean disconnect
|
||||
ConnectionLost, // unexpected disconnect
|
||||
VoiceOn, // my microphone stream started
|
||||
VoiceOff, // my microphone stream stopped
|
||||
PmRecv,
|
||||
PmSent,
|
||||
Login,
|
||||
Logout,
|
||||
ConnectionLost,
|
||||
VoiceOn,
|
||||
VoiceOff,
|
||||
VaStart, // my voice-activity began (off by default)
|
||||
VaStop, // my voice-activity ended (off by default)
|
||||
Ptt, // push-to-talk engaged (off by default)
|
||||
|
||||
@@ -7,30 +7,21 @@ internal static class Program
|
||||
[STAThread]
|
||||
private static void Main()
|
||||
{
|
||||
// Diagnostic-logging-only for now (manual debugging session) — every exception that
|
||||
// would otherwise be silently caught by WinForms' default message-loop handling (or
|
||||
// crash with no visible cause) gets printed to stdout/stderr first.
|
||||
// Surface exceptions that WinForms' default message-loop handling would otherwise
|
||||
// swallow silently (or crash with no visible cause).
|
||||
Application.ThreadException += (_, e) =>
|
||||
Console.Error.WriteLine($"[UNHANDLED ThreadException] {e.Exception}");
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
Console.Error.WriteLine($"[UNHANDLED AppDomain exception] {e.ExceptionObject}");
|
||||
|
||||
Console.WriteLine("VoiceCat.App starting...");
|
||||
ApplicationConfiguration.Initialize();
|
||||
|
||||
using var connectDialog = new ConnectDialog();
|
||||
Console.WriteLine("Showing ConnectDialog...");
|
||||
var result = connectDialog.ShowDialog();
|
||||
Console.WriteLine($"ConnectDialog closed with DialogResult={result}, ConnectedClient={(connectDialog.ConnectedClient is null ? "null" : "set")}");
|
||||
if (result != DialogResult.OK || connectDialog.ConnectedClient is null)
|
||||
{
|
||||
Console.WriteLine("Exiting (cancelled or no connected client).");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Launching MainForm...");
|
||||
Application.Run(new MainForm(connectDialog.ConnectedClient, connectDialog.SelfUserId,
|
||||
connectDialog.Nickname, connectDialog.ServerName));
|
||||
Console.WriteLine("MainForm closed. Exiting.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user