about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-08-14 05:07:51 +0200
committerEmma@Rory& <root@rory.gay>2023-08-14 05:11:21 +0200
commitaa7026a17ededf7c181ed269c6388491d96e1b1e (patch)
tree963b45cebbfefb3c5cebaf4ba7134a0e32eb0147 /MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
parentAdd latest code before splitting projects (diff)
downloadMatrixUtils-aa7026a17ededf7c181ed269c6388491d96e1b1e.tar.xz
Split LibMatrix into submodule
Diffstat (limited to 'MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs')
-rw-r--r--MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs28
1 files changed, 0 insertions, 28 deletions
diff --git a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs
deleted file mode 100644

index 1b93064..0000000 --- a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs +++ /dev/null
@@ -1,28 +0,0 @@ -using System.Text.Json; -using MatrixRoomUtils.Core.Extensions; -using MatrixRoomUtils.Core.Interfaces; -using MatrixRoomUtils.Core.Responses; - -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; - } - - private static SemaphoreSlim _semaphore = new(1, 1); - public async IAsyncEnumerable<GenericRoom> GetRoomsAsync(bool includeRemoved = false) { - await _semaphore.WaitAsync(); - var rooms = new List<GenericRoom>(); - var state = GetFullStateAsync(); - await foreach (var stateEvent in state) { - if (stateEvent.Type != "m.space.child") continue; - if (stateEvent.RawContent.ToJson() != "{}" || includeRemoved) - yield return await _homeServer.GetRoom(stateEvent.StateKey); - } - _semaphore.Release(); - } -} \ No newline at end of file