From afb0fc37db992c3aabb3e0e47669f1324662d44c Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 8 Feb 2025 21:52:16 +0100 Subject: Change defaults of GetManyMessages --- LibMatrix/RoomTypes/GenericRoom.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'LibMatrix') 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 GetMessagesAsync(string from = "", int? limit = null, string dir = "b", string? filter = "", SyncFilter.EventFilter? filterObject = null) { + public async Task 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(url); @@ -153,12 +152,12 @@ public class GenericRoom { /// /// Same as , except keeps fetching more responses until the beginning of the room is found, or the target message limit is reached /// - public async IAsyncEnumerable 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 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(); 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(); -- cgit 1.5.1