about summary refs log tree commit diff
path: root/LibMatrix/Responses/SyncResponse.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Responses/SyncResponse.cs')
-rw-r--r--LibMatrix/Responses/SyncResponse.cs14
1 files changed, 9 insertions, 5 deletions
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<string, int>? DeviceOneTimeKeysCount { get; set; } = null!;
@@ -37,10 +38,6 @@ public class SyncResponse {
     }
 
     // supporting classes
-    public class PresenceDataStructure {
-        [JsonPropertyName("events")]
-        public List<StateEventResponse> 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 {