using System.Text.Json.Serialization; using System.Text.RegularExpressions; namespace LibMatrix.EventTypes.Spec.State.RoomInfo; [MatrixEvent(EventName = EventId)] public class RoomServerAclEventContent : EventContent { public const string EventId = "m.room.server_acl"; [JsonPropertyName("allow")] public List? Allow { get; set; } [JsonPropertyName("deny")] public List? Deny { get; set; } [JsonPropertyName("allow_ip_literals")] public bool AllowIpLiterals { get; set; } // = false; [JsonIgnore] public List? AllowRegexes => Allow?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? []; [JsonIgnore] public List? DenyRegexes => Deny?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? []; }