namespace AcDream.Core.Social; /// Authoritative copy of retail's server-supplied SquelchDB. 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 MessageTypes); public sealed record SquelchDatabase( IReadOnlyDictionary Accounts, IReadOnlyDictionary Characters, SquelchInfo Global) { public static SquelchDatabase Empty { get; } = new( new Dictionary(StringComparer.OrdinalIgnoreCase), new Dictionary(), new SquelchInfo(string.Empty, false, new HashSet())); }