crypto: Improve the log line when we share group sessions

master
Damir Jelić 2021-01-18 14:15:31 +01:00
parent 436530e874
commit 4eb504d000
1 changed files with 13 additions and 9 deletions

View File

@ -21,7 +21,7 @@ use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::to_device::DeviceIdOrAllDevices, api::r0::to_device::DeviceIdOrAllDevices,
events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, EventType}, events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, EventType},
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId}, identifiers::{DeviceIdBox, RoomId, UserId},
uuid::Uuid, uuid::Uuid,
}; };
use tracing::{debug, info}; use tracing::{debug, info};
@ -236,14 +236,18 @@ impl GroupSessionManager {
.flatten() .flatten()
.collect(); .collect();
info!( if !devices.is_empty() {
"Sharing outbound session at index {} with {:?}", info!(
outbound.message_index().await, "Sharing outbound session at index {} with {:?}",
devices outbound.message_index().await,
.iter() devices.iter().fold(HashMap::new(), |mut acc, d| {
.map(|d| (d.user_id(), d.device_id())) acc.entry(d.user_id())
.collect::<Vec<(&UserId, &DeviceId)>>() .or_insert_with(Vec::new)
); .push(d.device_id());
acc
})
);
}
let key_content = outbound.as_json().await; let key_content = outbound.as_json().await;