about summary refs log tree commit diff
path: root/LibMatrix/StateEvent.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-09 17:28:08 +0200
committerRory& <root@rory.gay>2025-05-14 14:11:52 +0200
commit9460daa7262a88a6955ef2d61b89fe83ce63849f (patch)
tree4763c3916027aabcc688962a6213d0af891e0b84 /LibMatrix/StateEvent.cs
parentmsc4222 fixes (diff)
downloadLibMatrix-9460daa7262a88a6955ef2d61b89fe83ce63849f.tar.xz
Add helper to check if type and state key for 2 events match, or 2
events are equal
Diffstat (limited to 'LibMatrix/StateEvent.cs')
-rw-r--r--LibMatrix/StateEvent.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/StateEvent.cs

index ef760e1..e2ac87e 100644 --- a/LibMatrix/StateEvent.cs +++ b/LibMatrix/StateEvent.cs
@@ -100,13 +100,10 @@ public class StateEvent { [JsonPropertyName("replaces_state")] public string? ReplacesState { get; set; } - private JsonObject? _rawContent; - [JsonPropertyName("content")] - public JsonObject? RawContent { - get => _rawContent; - set => _rawContent = value; - } + // [field: AllowNull, MaybeNull] + [NotNull] + public JsonObject? RawContent { get; set; } //debug [JsonIgnore] @@ -122,6 +119,9 @@ public class StateEvent { [JsonIgnore] public string InternalContentTypeName => TypedContent?.GetType().Name ?? "null"; + + public static bool TypeKeyPairMatches(StateEventResponse x, StateEventResponse y) => x.Type == y.Type && x.StateKey == y.StateKey; + public static bool Equals(StateEventResponse x, StateEventResponse y) => x.Type == y.Type && x.StateKey == y.StateKey && x.RawContent.Equals(y.RawContent); } public class StateEventResponse : StateEvent {