about summary refs log tree commit diff
path: root/LibMatrix.EventTypes
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-27 19:45:22 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-27 19:45:22 +0100
commit94b83d4de5e435796da9cc14667c1023a09df8eb (patch)
tree359f0d41431d4f647dddd213ab44f20780531ccd /LibMatrix.EventTypes
parentSetImpersonate optimisation (dont execute if already set), cleanup (diff)
downloadLibMatrix-bak-94b83d4de5e435796da9cc14667c1023a09df8eb.tar.xz
Cleanup
Diffstat (limited to 'LibMatrix.EventTypes')
-rw-r--r--LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs6
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs9
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs1
6 files changed, 18 insertions, 5 deletions
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";
     /// <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!
     }
 }
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; }
 }