about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-30 03:36:58 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-30 03:36:58 +0200
commitbb8c2637af3b7982e7a4b2fd15e2fbec613d0848 (patch)
treeb8075ba7e507aad3f96f354712ad920ac421e474 /MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
parentUpdate stuff (diff)
downloadMatrixUtils-bb8c2637af3b7982e7a4b2fd15e2fbec613d0848.tar.xz
Todays progress
Diffstat (limited to 'MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs')
-rw-r--r--MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs14
1 files changed, 6 insertions, 8 deletions
diff --git a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs

index 6b586c7..3be3130 100644 --- a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs +++ b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
@@ -8,20 +8,18 @@ namespace MatrixRoomUtils.Core.RoomTypes; public class SpaceRoom : GenericRoom { private readonly AuthenticatedHomeServer _homeServer; private readonly GenericRoom _room; + public SpaceRoom(AuthenticatedHomeServer homeServer, string roomId) : base(homeServer, roomId) { _homeServer = homeServer; } public async Task<List<GenericRoom>> GetRoomsAsync(bool includeRemoved = false) { var rooms = new List<GenericRoom>(); - var state = await GetStateAsync(""); - if (state != null) { - var states = state.Value.Deserialize<StateEventResponse[]>()!; - foreach (var stateEvent in states.Where(x => x.Type == "m.space.child")) { - var roomId = stateEvent.StateKey; - if(stateEvent.TypedContent.ToJson() != "{}" || includeRemoved) - rooms.Add(await _homeServer.GetRoom(roomId)); - } + var state = GetFullStateAsync().ToBlockingEnumerable().ToList(); + var childStates = state.Where(x => x.Type == "m.space.child"); + foreach (var stateEvent in childStates) { + if (stateEvent.TypedContent.ToJson() != "{}" || includeRemoved) + rooms.Add(await _homeServer.GetRoom(stateEvent.StateKey)); } return rooms;