about summary refs log tree commit diff
path: root/LibMatrix/RoomTypes
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-05-02 07:20:13 +0200
committerRory& <root@rory.gay>2024-05-02 07:20:13 +0200
commit508c694c3d551cddb3b15c1b0d4787dae3c00530 (patch)
treebabe9f57e40f0014a9158eaf9f798c434ce9d380 /LibMatrix/RoomTypes
parentFixes (diff)
downloadLibMatrix-508c694c3d551cddb3b15c1b0d4787dae3c00530.tar.xz
HomeserverEmulator work
Diffstat (limited to 'LibMatrix/RoomTypes')
-rw-r--r--LibMatrix/RoomTypes/GenericRoom.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs

index 43f3acc..742f5d9 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -517,18 +517,20 @@ public class GenericRoom { #endregion public async IAsyncEnumerable<StateEventResponse> GetRelatedEventsAsync(string eventId, string? relationType = null, string? eventType = null, string? dir = "f", - string? from = null, int? chunkLimit = 100, bool? recurse = false, string? to = null) { - var path = $"/_matrix/client/v3/rooms/{RoomId}/relations/{eventId}"; + string? from = null, int? chunkLimit = 100, bool? recurse = null, string? to = null) { + var path = $"/_matrix/client/v1/rooms/{RoomId}/relations/{HttpUtility.UrlEncode(eventId)}"; if (!string.IsNullOrEmpty(relationType)) path += $"/{relationType}"; if (!string.IsNullOrEmpty(eventType)) path += $"/{eventType}"; var uri = new Uri(path, UriKind.Relative); if (dir == "b" || dir == "f") uri = uri.AddQuery("dir", dir); + else if(!string.IsNullOrWhiteSpace(dir)) throw new ArgumentException("Invalid direction", nameof(dir)); if (!string.IsNullOrEmpty(from)) uri = uri.AddQuery("from", from); if (chunkLimit is not null) uri = uri.AddQuery("limit", chunkLimit.Value.ToString()); if (recurse is not null) uri = uri.AddQuery("recurse", recurse.Value.ToString()); if (!string.IsNullOrEmpty(to)) uri = uri.AddQuery("to", to); + // Console.WriteLine($"Getting related events from {uri}"); var result = await Homeserver.ClientHttpClient.GetFromJsonAsync<RecursedBatchedChunkedStateEventResponse>(uri); while (result!.Chunk.Count > 0) { foreach (var resp in result.Chunk) {