about summary refs log tree commit diff
path: root/LibMatrix/AuthenticatedHomeServer.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:46:11 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 19:46:11 +0200
commitcb8846a7a3310f8513989da5aadb5202f048a1b3 (patch)
treecfbcf2506947d0f820208dd4cdb7a56c660ef0f9 /LibMatrix/AuthenticatedHomeServer.cs
parentUpdate dependencies (diff)
downloadLibMatrix-bak-cb8846a7a3310f8513989da5aadb5202f048a1b3.tar.xz
Code cleanup
Diffstat (limited to 'LibMatrix/AuthenticatedHomeServer.cs')
-rw-r--r--LibMatrix/AuthenticatedHomeServer.cs5
1 files changed, 2 insertions, 3 deletions
diff --git a/LibMatrix/AuthenticatedHomeServer.cs b/LibMatrix/AuthenticatedHomeServer.cs

index 102d448..a99dc27 100644 --- a/LibMatrix/AuthenticatedHomeServer.cs +++ b/LibMatrix/AuthenticatedHomeServer.cs
@@ -32,14 +32,13 @@ public class AuthenticatedHomeServer : IHomeServer { public string AccessToken { get; set; } - public async Task<GenericRoom> GetRoom(string roomId) => new(this, roomId); + public Task<GenericRoom> GetRoom(string roomId) => Task.FromResult<GenericRoom>(new(this, roomId)); public async Task<List<GenericRoom>> GetJoinedRooms() { - var rooms = new List<GenericRoom>(); var roomQuery = await _httpClient.GetAsync("/_matrix/client/v3/joined_rooms"); var roomsJson = await roomQuery.Content.ReadFromJsonAsync<JsonElement>(); - foreach (var room in roomsJson.GetProperty("joined_rooms").EnumerateArray()) rooms.Add(new GenericRoom(this, room.GetString())); + var rooms = roomsJson.GetProperty("joined_rooms").EnumerateArray().Select(room => new GenericRoom(this, room.GetString()!)).ToList(); Console.WriteLine($"Fetched {rooms.Count} rooms");