blob: c7ad4913831384ee277c07455b17229123981f23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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<string>? Allow { get; set; }
[JsonPropertyName("deny")]
public List<string>? Deny { get; set; }
[JsonPropertyName("allow_ip_literals")]
public bool AllowIpLiterals { get; set; } // = false;
[JsonIgnore]
public List<Regex>? AllowRegexes => Allow?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? [];
[JsonIgnore]
public List<Regex>? DenyRegexes => Deny?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? [];
}
|