about summary refs log tree commit diff
path: root/LibMatrix/RoomTypes/GenericRoom.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-08-22 17:36:27 +0200
committerRory& <root@rory.gay>2025-08-22 17:36:27 +0200
commit013f1693885a5de01ae357af2909589e925863d5 (patch)
treeb506dfd0eacdd1e25159141478b643e4da04ab38 /LibMatrix/RoomTypes/GenericRoom.cs
parentSome cleanup, further room builder work (diff)
downloadLibMatrix-013f1693885a5de01ae357af2909589e925863d5.tar.xz
Bulk sending, policy interpreting improvements, room upgrade builder work
Diffstat (limited to 'LibMatrix/RoomTypes/GenericRoom.cs')
-rw-r--r--LibMatrix/RoomTypes/GenericRoom.cs20
1 files changed, 12 insertions, 8 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs

index 9753176..0077acb 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -623,10 +623,12 @@ public class GenericRoom { } } - public async Task BulkSendEventsAsync(IEnumerable<StateEvent> events) { - if ((await Homeserver.GetCapabilitiesAsync()).Capabilities.BulkSendEvents?.Enabled == true) - await Homeserver.ClientHttpClient.PostAsJsonAsync( - $"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{RoomId}/bulk_send_events?_libmatrix_txn_id={Guid.NewGuid()}", events); + public async Task BulkSendEventsAsync(IEnumerable<StateEvent> events, int? forceSyncInterval = null) { + if ((await Homeserver.GetCapabilitiesAsync()).Capabilities.BulkSendEvents?.Enabled == true) { + var uri = $"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{RoomId}/bulk_send_events?_libmatrix_txn_id={Guid.NewGuid()}"; + if (forceSyncInterval is not null) uri += $"&force_sync_interval={forceSyncInterval}"; + await Homeserver.ClientHttpClient.PostAsJsonAsync(uri, events); + } else { Console.WriteLine("Homeserver does not support bulk sending events, falling back to individual sends."); foreach (var evt in events) @@ -638,10 +640,12 @@ public class GenericRoom { } } - public async Task BulkSendEventsAsync(IAsyncEnumerable<StateEvent> events) { - if ((await Homeserver.GetCapabilitiesAsync()).Capabilities.BulkSendEvents?.Enabled == true) - await Homeserver.ClientHttpClient.PostAsJsonAsync( - $"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{RoomId}/bulk_send_events?_libmatrix_txn_id={Guid.NewGuid()}", events); + public async Task BulkSendEventsAsync(IAsyncEnumerable<StateEvent> events, int? forceSyncInterval = null) { + if ((await Homeserver.GetCapabilitiesAsync()).Capabilities.BulkSendEvents?.Enabled == true) { + var uri = $"/_matrix/client/unstable/gay.rory.bulk_send_events/rooms/{RoomId}/bulk_send_events?_libmatrix_txn_id={Guid.NewGuid()}"; + if (forceSyncInterval is not null) uri += $"&force_sync_interval={forceSyncInterval}"; + await Homeserver.ClientHttpClient.PostAsJsonAsync(uri, events); + } else { Console.WriteLine("Homeserver does not support bulk sending events, falling back to individual sends."); await foreach (var evt in events)