about summary refs log tree commit diff
path: root/LibMatrix/StateEvent.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-06-16 06:43:44 +0200
committerRory& <root@rory.gay>2025-06-16 06:43:44 +0200
commit2f8a17fab9b13cbeb93f3d7b07b0bb51d17aa8b2 (patch)
tree475ea33e96766188f4f1d3f1007be190e3fab24c /LibMatrix/StateEvent.cs
parentSynapse admin fixes, server resolution fixes (diff)
downloadLibMatrix-2f8a17fab9b13cbeb93f3d7b07b0bb51d17aa8b2.tar.xz
Room builder, support managing room dir
Diffstat (limited to 'LibMatrix/StateEvent.cs')
-rw-r--r--LibMatrix/StateEvent.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/StateEvent.cs

index a1ca9dc..af25805 100644 --- a/LibMatrix/StateEvent.cs +++ b/LibMatrix/StateEvent.cs
@@ -121,7 +121,16 @@ public class StateEvent { 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 && JsonNode.DeepEquals(x.RawContent, y.RawContent); + public static bool Equals(StateEventResponse x, StateEventResponse y) => x.Type == y.Type && x.StateKey == y.StateKey && x.EventId == y.EventId; + + /// <summary> + /// Compares two state events for deep equality, including type, state key, and raw content. + /// If you trust the server, use Equals instead, as that compares by event ID instead of raw content. + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + public static bool DeepEquals(StateEventResponse x, StateEventResponse y) => x.Type == y.Type && x.StateKey == y.StateKey && JsonNode.DeepEquals(x.RawContent, y.RawContent); } public class StateEventResponse : StateEvent {