crytpo: Get the one-time keys count out of the sync response as well.

This commit is contained in:
Damir Jelić 2020-03-12 16:14:43 +01:00
parent 8867b198f7
commit 545ebe8d9c
2 changed files with 10 additions and 3 deletions

View file

@ -302,9 +302,9 @@ impl Client {
#[cfg(feature = "encryption")]
{
let olm = self.olm.lock().await;
let mut olm = self.olm.lock().await;
if let Some(o) = &*olm {
if let Some(o) = &mut *olm {
o.receive_sync_response(response);
}
}

View file

@ -336,7 +336,14 @@ impl OlmMachine {
// TODO handle to-device verification events here.
}
pub fn receive_sync_response(&self, response: &mut SyncResponse) {
pub fn receive_sync_response(&mut self, response: &mut SyncResponse) {
let one_time_key_count = response
.device_one_time_keys_count
.get(&keys::KeyAlgorithm::SignedCurve25519);
let count: u64 = one_time_key_count.map_or(0, |c| (*c).into());
self.uploaded_signed_key_count = Some(count);
for event in response.to_device.events.iter() {
let event = if let EventResult::Ok(e) = event {
e