NoSoliciting/NoSoliciting/PluginConfiguration.cs
Anna 37b9694144 feat: add online definitions and FC/RP filters
Definitions for the built-in filters (RMT, FC, and RP) are now
downloaded from the git repo on plugin start and whenever the update
button is pressed. This will allow faster response to messages that
slip through, as updates can be pushed right away without needing to
release a new version.

After a successful download, the plugin writes the result to a cache
file in its config directory. In the event a download fails, the
plugin will fall back to that cached file. If that cached file does
not exist or fails to deserialise, the plugin will fall back to a file
included with each release after this commit called
default_definitions.yaml. If that file is missing (really only
possible because the user deleted it), an exception will be thrown.

Free Company recruitment messages and roleplaying advertisements are
now able to be filtered using built-in filters, hopefully making shout
chat and the Party Finder more bearable. As always, these are optional
filters (both default to disabled).
2020-08-21 05:00:04 -04:00

40 lines
1.3 KiB
C#

using Dalamud.Configuration;
using Dalamud.Plugin;
using System;
using System.Collections.Generic;
namespace NoSoliciting {
[Serializable]
public class PluginConfiguration : IPluginConfiguration {
[NonSerialized]
private DalamudPluginInterface pi;
public int Version { get; set; } = 1;
public bool FilterChat { get; set; } = true;
public bool FilterFCRecruitments { get; set; } = false;
public bool FilterChatRPAds { get; set; } = false;
public bool FilterPartyFinder { get; set; } = true;
public bool FilterPartyFinderRPAds { get; set; } = false;
public bool AdvancedMode { get; set; } = false;
public bool CustomChatFilter { get; set; } = false;
public List<string> ChatSubstrings { get; } = new List<string>();
public List<string> ChatRegexes { get; } = new List<string>();
public bool CustomPFFilter { get; set; } = false;
public List<string> PFSubstrings { get; } = new List<string>();
public List<string> PFRegexes { get; } = new List<string>();
public void Initialise(DalamudPluginInterface pi) {
this.pi = pi ?? throw new ArgumentNullException(nameof(pi), "DalamudPluginInterface cannot be null");
}
public void Save() {
this.pi.SavePluginConfig(this);
}
}
}