From 94b83d4de5e435796da9cc14667c1023a09df8eb Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Wed, 27 Dec 2023 19:45:22 +0100 Subject: Cleanup --- .../Spec/State/RoomInfo/RoomJoinRulesEventContent.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs') 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! } } -- cgit 1.4.1