about summary refs log tree commit diff
path: root/LibMatrix/RoomTypes
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-02-08 21:52:16 +0100
committerRory& <root@rory.gay>2025-02-08 22:17:28 +0100
commitafb0fc37db992c3aabb3e0e47669f1324662d44c (patch)
tree619eef673e782cef9296f41b70b668a0e8f9ddeb /LibMatrix/RoomTypes
parentTemporary work (diff)
downloadLibMatrix-afb0fc37db992c3aabb3e0e47669f1324662d44c.tar.xz
Change defaults of GetManyMessages
Diffstat (limited to 'LibMatrix/RoomTypes')
-rw-r--r--LibMatrix/RoomTypes/GenericRoom.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs

index 0863284..202bfc1 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -139,11 +139,10 @@ public class GenericRoom { } } - public async Task<MessagesResponse> GetMessagesAsync(string from = "", int? limit = null, string dir = "b", string? filter = "", SyncFilter.EventFilter? filterObject = null) { + public async Task<MessagesResponse> GetMessagesAsync(string from = "", int? limit = null, string dir = "b", string? filter = "") { var url = $"/_matrix/client/v3/rooms/{RoomId}/messages?dir={dir}"; if (!string.IsNullOrWhiteSpace(from)) url += $"&from={from}"; if (limit is not null) url += $"&limit={limit}"; - if(filterObject is not null) url += $"&filter={filterObject.ToJson()}"; else if (!string.IsNullOrWhiteSpace(filter)) url += $"&filter={filter}"; var res = await Homeserver.ClientHttpClient.GetFromJsonAsync<MessagesResponse>(url); @@ -153,12 +152,12 @@ public class GenericRoom { /// <summary> /// Same as <see cref="GetMessagesAsync"/>, except keeps fetching more responses until the beginning of the room is found, or the target message limit is reached /// </summary> - public async IAsyncEnumerable<MessagesResponse> GetManyMessagesAsync(string from = "", int limit = int.MaxValue, string dir = "b", string? filter = "", - SyncFilter.EventFilter? filterObject = null, bool includeState = true, bool fixForward = false, int chunkSize = 100) { + public async IAsyncEnumerable<MessagesResponse> GetManyMessagesAsync(string from = "", int limit = int.MaxValue, string dir = "b", string filter = "", bool includeState = true, + bool fixForward = false, int chunkSize = 250) { if (dir == "f" && fixForward) { var concat = new List<MessagesResponse>(); while (true) { - var resp = await GetMessagesAsync(from, int.MaxValue, "b", filter, filterObject); + var resp = await GetMessagesAsync(from, int.MaxValue, "b", filter); concat.Add(resp); if (!includeState) resp.State.Clear();