diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-27 19:45:22 +0100 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-27 19:45:22 +0100 |
commit | 94b83d4de5e435796da9cc14667c1023a09df8eb (patch) | |
tree | 359f0d41431d4f647dddd213ab44f20780531ccd /LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs | |
parent | SetImpersonate optimisation (dont execute if already set), cleanup (diff) | |
download | LibMatrix-94b83d4de5e435796da9cc14667c1023a09df8eb.tar.xz |
Cleanup
Diffstat (limited to 'LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs')
-rw-r--r-- | LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs | 9 |
1 files changed, 6 insertions, 3 deletions
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"; /// <summary> /// one of ["public", "invite", "knock", "restricted", "knock_restricted"] /// "private" is reserved without implementation! + /// unknown values are treated as "private" /// </summary> [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! } } |