From 9f8d0c85c54b4715974994aea52562072d6f1751 Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Wed, 31 Jan 2024 12:09:28 +0100 Subject: Better sync filter support, named filters, error handling --- .../Spec/State/Policy/PolicyRuleStateEventContent.cs | 5 ++++- .../Spec/State/RoomInfo/RoomPowerLevelEventContent.cs | 1 + .../Spec/State/RoomInfo/RoomServerACLEventContent.cs | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'LibMatrix.EventTypes') diff --git a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs index 5293082..5cc5957 100644 --- a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs @@ -85,7 +85,10 @@ public abstract class PolicyRuleEventContent : EventContent { [FriendlyName(Name = "Expires at")] public DateTime? ExpiryDateTime { get => Expiry == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(Expiry.Value).DateTime; - set => Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds(); + set { + if(value is not null) + Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds(); + } } } diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs index 15c742c..325a10e 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs @@ -3,6 +3,7 @@ using System.Text.Json.Serialization; namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = EventId)] +[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] public class RoomPowerLevelEventContent : EventContent { public const string EventId = "m.room.power_levels"; diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs index c1e1127..b720b14 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs @@ -4,6 +4,8 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.server_acl")] public class RoomServerACLEventContent : EventContent { + public const string EventId = "m.room.server_acl"; + [JsonPropertyName("allow")] public List? Allow { get; set; } // = null!; -- cgit 1.4.1