From 30c07b4e0878db11b375e0a2537f13e3d0b6e602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 30 Jul 2020 15:53:55 +0200 Subject: [PATCH] matrix-sdk: Send out to-device events in the sync_forever() loop. --- matrix_sdk/src/client.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 97e7a00f..b2dad9ce 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -1254,8 +1254,6 @@ impl Client { } }; - // TODO send out to-device messages here - #[cfg(feature = "encryption")] { if self.base_client.should_upload_keys().await { @@ -1273,6 +1271,16 @@ impl Client { warn!("Error while querying device keys {:?}", e); } } + + for request in self.base_client.outgoing_to_device_requests().await { + let transaction_id = request.txn_id.clone(); + + if let Ok(_) = self.send(request).await { + self.base_client + .mark_to_device_request_as_sent(&transaction_id) + .await; + } + } } callback(response).await;