feat(privacy): log warning on unknown ChatType in IsAllowedForStorage
F3.2: a future FFXIV patch can introduce ChatTypes that aren't on any existing whitelist, and the filter currently routes them silently through the unknown-channel failsafe. Add a dedup HashSet (per runtime, NonSerialized) so the first hit per ChatType logs a Warning. The failsafe behaviour itself is unchanged — only visibility is new.
This commit is contained in:
@@ -64,12 +64,30 @@ public class Configuration : IPluginConfiguration
|
|||||||
.PrivacyDefaults
|
.PrivacyDefaults
|
||||||
.DefaultPersistUnknownChannels;
|
.DefaultPersistUnknownChannels;
|
||||||
|
|
||||||
|
// F3.2: dedup unknown-ChatType warnings so a chatty filter doesn't spam
|
||||||
|
// the log every frame. NonSerialized so the warning fires once per
|
||||||
|
// runtime, not once-ever-per-install.
|
||||||
|
[NonSerialized]
|
||||||
|
private readonly HashSet<ChatType> _warnedUnknownChannels = new();
|
||||||
|
|
||||||
public bool IsAllowedForStorage(ChatType type)
|
public bool IsAllowedForStorage(ChatType type)
|
||||||
{
|
{
|
||||||
if (!PrivacyFilterEnabled)
|
if (!PrivacyFilterEnabled)
|
||||||
return true;
|
return true;
|
||||||
if (PrivacyPersistChannels.Contains(type))
|
if (PrivacyPersistChannels.Contains(type))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// F3.2: log first occurrence so a new patch's ChatType doesn't drop
|
||||||
|
// off the radar. Failsafe still applies via PrivacyPersistUnknownChannels.
|
||||||
|
if (_warnedUnknownChannels.Add(type))
|
||||||
|
{
|
||||||
|
Plugin.Log.Warning(
|
||||||
|
"PrivacyFilter: unknown ChatType {Type} — falling back to PrivacyPersistUnknownChannels={Persist}.",
|
||||||
|
type,
|
||||||
|
PrivacyPersistUnknownChannels
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return PrivacyPersistUnknownChannels;
|
return PrivacyPersistUnknownChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user