crypto: Mark tracked users as changed if a sync tells us so.

This commit is contained in:
Damir Jelić 2020-05-21 14:30:42 +02:00
parent 1d9fccdc9f
commit 6ecf46abf7
2 changed files with 15 additions and 2 deletions

View file

@ -35,7 +35,6 @@ features = ["sync", "fs"]
[dev-dependencies]
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
http = "0.2.1"
dirs = "2.0.2"
tracing-subscriber = "0.2.5"
tempfile = "3.1.0"

View file

@ -13,7 +13,7 @@
// limitations under the License.
use std::collections::{BTreeMap, HashMap, HashSet};
use std::convert::TryInto;
use std::convert::{TryFrom, TryInto};
use std::mem;
#[cfg(feature = "sqlite-cryptostore")]
use std::path::Path;
@ -1404,6 +1404,20 @@ impl OlmMachine {
let count: u64 = one_time_key_count.map_or(0, |c| (*c).into());
self.update_key_count(count);
if let Some(device_list) = &response.device_lists {
for user_id in &device_list.changed {
let user_id = if let Ok(u) = UserId::try_from(user_id.to_owned()) {
u
} else {
continue;
};
if let Err(e) = self.mark_user_as_changed(&user_id).await {
error!("Error marking a tracked user as changed {:?}", e);
}
}
}
for event_result in &mut response.to_device.events {
let event = if let Ok(e) = event_result.deserialize() {
e