From 94b83d4de5e435796da9cc14667c1023a09df8eb Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Wed, 27 Dec 2023 19:45:22 +0100 Subject: Cleanup --- LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs | 6 ++++++ .../Spec/State/RoomInfo/RoomEncryptionEventContent.cs | 1 + .../Spec/State/RoomInfo/RoomGuestAccessEventContent.cs | 3 ++- .../Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs | 3 ++- .../Spec/State/RoomInfo/RoomJoinRulesEventContent.cs | 9 ++++++--- .../Spec/State/RoomInfo/RoomTopicEventContent.cs | 1 + 6 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs (limited to 'LibMatrix.EventTypes') diff --git a/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs b/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs new file mode 100644 index 0000000..64b4f20 --- /dev/null +++ b/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs @@ -0,0 +1,6 @@ +namespace LibMatrix.EventTypes.Spec; + +[MatrixEvent(EventName = EventId)] +public class RoomMessageReactionEventContent : TimelineEventContent { + public const string EventId = "m.reaction"; +} diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs index 992b57c..5ddd7f3 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs @@ -4,6 +4,7 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.encryption")] public class RoomEncryptionEventContent : EventContent { + public const string EventId = "m.room.encryption"; [JsonPropertyName("algorithm")] public string? Algorithm { get; set; } [JsonPropertyName("rotation_period_ms")] diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs index 4f62eb1..5e6e4d2 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs @@ -4,8 +4,9 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.guest_access")] public class RoomGuestAccessEventContent : EventContent { + public const string EventId = "m.room.guest_access"; [JsonPropertyName("guest_access")] - public required string GuestAccess { get; set; } + public string GuestAccess { get; set; } [JsonIgnore] public bool IsGuestAccessEnabled { diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs index 48ba538..c523e5e 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs @@ -4,6 +4,7 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.history_visibility")] public class RoomHistoryVisibilityEventContent : EventContent { + public const string EventId = "m.room.history_visibility"; [JsonPropertyName("history_visibility")] - public required string HistoryVisibility { get; set; } + public string HistoryVisibility { get; set; } } diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs index 0663288..981d927 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs @@ -4,9 +4,11 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.join_rules")] public class RoomJoinRulesEventContent : EventContent { + public const string EventId = "m.room.join_rules"; /// /// one of ["public", "invite", "knock", "restricted", "knock_restricted"] /// "private" is reserved without implementation! + /// unknown values are treated as "private" /// [JsonPropertyName("join_rule")] public string JoinRuleValue { get; set; } @@ -19,7 +21,7 @@ public class RoomJoinRulesEventContent : EventContent { "knock" => JoinRules.Knock, "restricted" => JoinRules.Restricted, "knock_restricted" => JoinRules.KnockRestricted, - _ => throw new ArgumentOutOfRangeException() + _ => JoinRules.Private }; set => JoinRuleValue = value switch { JoinRules.Public => "public", @@ -27,7 +29,7 @@ public class RoomJoinRulesEventContent : EventContent { JoinRules.Knock => "knock", JoinRules.Restricted => "restricted", JoinRules.KnockRestricted => "knock_restricted", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => "private" }; } @@ -47,6 +49,7 @@ public class RoomJoinRulesEventContent : EventContent { Invite, Knock, Restricted, - KnockRestricted + KnockRestricted, + Private // reserved without implementation! } } diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs index 37536d2..8abb2c8 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs @@ -5,6 +5,7 @@ namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.topic")] [MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)] public class RoomTopicEventContent : EventContent { + public const string EventId = "m.room.topic"; [JsonPropertyName("topic")] public string? Topic { get; set; } } -- cgit 1.4.1