From 3a9e65d3759b761647e96d9066435ce3863258a2 Mon Sep 17 00:00:00 2001 From: td Date: Mon, 17 Mar 2025 15:27:43 +0100 Subject: [PATCH] feat: allow skipping existing chat when calling startDirectChat feat: also allow specifying timeout duration in oneShotSync --- lib/src/client.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 6d304717..6548bfb3 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -783,10 +783,11 @@ class Client extends MatrixApi { bool waitForSync = true, Map? powerLevelContentOverride, CreateRoomPreset? preset = CreateRoomPreset.trustedPrivateChat, + bool skipExistingChat = false, }) async { // Try to find an existing direct chat final directChatRoomId = getDirectChatFromUserId(mxid); - if (directChatRoomId != null) { + if (directChatRoomId != null && !skipExistingChat) { final room = getRoomById(directChatRoomId); if (room != null) { if (room.membership == Membership.join) { @@ -2266,8 +2267,8 @@ class Client extends MatrixApi { /// Immediately start a sync and wait for completion. /// If there is an active sync already, wait for the active sync instead. - Future oneShotSync() { - return _sync(); + Future oneShotSync({Duration? timeout}) { + return _sync(timeout: timeout); } /// Pass a timeout to set how long the server waits before sending an empty response.