acdream/src/AcDream.Core/Social/SquelchState.cs
Erik 9ea579bdd0 feat(chat): port retail client command families
Expand the typed client-command boundary across travel, character queries, local UI and layout controls, AFK and consent, emotes, friends, squelch and filters, and fill-components. Preserve retail packet layouts and queue ownership, import the confirmation dialog, and keep authoritative social state in Core.

Co-Authored-By: Codex <codex@openai.com>
2026-07-13 14:50:15 +02:00

35 lines
1 KiB
C#

namespace AcDream.Core.Social;
/// <summary>Authoritative copy of retail's server-supplied <c>SquelchDB</c>.</summary>
public sealed class SquelchState
{
private readonly object _gate = new();
private SquelchDatabase _database = SquelchDatabase.Empty;
public SquelchDatabase Snapshot()
{
lock (_gate) return _database;
}
public void Replace(SquelchDatabase database)
{
ArgumentNullException.ThrowIfNull(database);
lock (_gate) _database = database;
}
}
public sealed record SquelchInfo(
string Name,
bool AccountWide,
IReadOnlySet<uint> MessageTypes);
public sealed record SquelchDatabase(
IReadOnlyDictionary<string, uint> Accounts,
IReadOnlyDictionary<uint, SquelchInfo> Characters,
SquelchInfo Global)
{
public static SquelchDatabase Empty { get; } = new(
new Dictionary<string, uint>(StringComparer.OrdinalIgnoreCase),
new Dictionary<uint, SquelchInfo>(),
new SquelchInfo(string.Empty, false, new HashSet<uint>()));
}