matrix-sdk: Send out to-device events in the sync_forever() loop.

master
Damir Jelić 2020-07-30 15:53:55 +02:00
parent d9fbc18777
commit 30c07b4e08
1 changed files with 10 additions and 2 deletions

View File

@ -1254,8 +1254,6 @@ impl Client {
} }
}; };
// TODO send out to-device messages here
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
{ {
if self.base_client.should_upload_keys().await { if self.base_client.should_upload_keys().await {
@ -1273,6 +1271,16 @@ impl Client {
warn!("Error while querying device keys {:?}", e); 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; callback(response).await;