From 3b488242050bbc0521d846bd31cb6ea59b8d4e38 Mon Sep 17 00:00:00 2001 From: Rory& Date: Mon, 5 Aug 2024 06:49:58 +0200 Subject: Sync storage --- LibMatrix/Responses/SyncResponse.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'LibMatrix/Responses/SyncResponse.cs') diff --git a/LibMatrix/Responses/SyncResponse.cs b/LibMatrix/Responses/SyncResponse.cs index e4addb6..d807ecb 100644 --- a/LibMatrix/Responses/SyncResponse.cs +++ b/LibMatrix/Responses/SyncResponse.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using LibMatrix.EventTypes.Spec.State; namespace LibMatrix.Responses; @@ -14,7 +15,7 @@ public class SyncResponse { public EventList? AccountData { get; set; } [JsonPropertyName("presence")] - public PresenceDataStructure? Presence { get; set; } + public EventList? Presence { get; set; } [JsonPropertyName("device_one_time_keys_count")] public Dictionary? DeviceOneTimeKeysCount { get; set; } = null!; @@ -37,10 +38,6 @@ public class SyncResponse { } // supporting classes - public class PresenceDataStructure { - [JsonPropertyName("events")] - public List Events { get; set; } = new(); - } public class RoomsDataStructure { [JsonPropertyName("join")] @@ -61,6 +58,13 @@ public class SyncResponse { [JsonPropertyName("state")] public EventList? State { get; set; } + + public override string ToString() { + var lastEvent = Timeline?.Events?.LastOrDefault(x=>x.Type == "m.room.member"); + var membership = (lastEvent?.TypedContent as RoomMemberEventContent); + return $"LeftRoomDataStructure: {lastEvent?.Sender} {membership?.Membership} ({membership?.Reason})"; + + } } public class JoinedRoomDataStructure { -- cgit 1.5.1