From 3d0829b2a07ffa0b90fc6f07d64e177ba562980d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 3 Apr 2020 10:21:14 +0200 Subject: [PATCH] crypto: Add the new devices to the store. --- src/crypto/machine.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/crypto/machine.rs b/src/crypto/machine.rs index aa3c2fc1..b3ace511 100644 --- a/src/crypto/machine.rs +++ b/src/crypto/machine.rs @@ -344,6 +344,8 @@ impl OlmMachine { &mut self, response: &keys::get_keys::Response, ) -> Result<()> { + let mut changed_devices = Vec::new(); + for (user_id, device_map) in &response.device_keys { let user_id_string = user_id.to_string(); self.users_for_key_query.remove(&user_id_string); @@ -400,6 +402,7 @@ impl OlmMachine { } else { let device = Device::from(device_keys); info!("Found new device {:?}", device); + changed_devices.push(device); } } @@ -413,6 +416,11 @@ impl OlmMachine { // TODO delete devices here. } } + + for device in changed_devices { + self.store.save_device(device).await.unwrap(); + } + Ok(()) }