crypto: Simplify the Olm message map construction.
parent
58185e08e8
commit
aaa15c768c
|
@ -1080,16 +1080,13 @@ impl OlmMachine {
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
if !messages.contains_key(device.user_id()) {
|
messages
|
||||||
messages.insert(device.user_id().clone(), BTreeMap::new());
|
.entry(device.user_id().clone())
|
||||||
};
|
.or_insert(BTreeMap::new())
|
||||||
|
.insert(
|
||||||
let user_messages = messages.get_mut(device.user_id()).unwrap();
|
DeviceIdOrAllDevices::DeviceId(device.device_id().into()),
|
||||||
|
serde_json::value::to_raw_value(&encrypted)?,
|
||||||
user_messages.insert(
|
);
|
||||||
DeviceIdOrAllDevices::DeviceId(device.device_id().into()),
|
|
||||||
serde_json::value::to_raw_value(&encrypted)?,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
requests.push(OwnedToDeviceRequest {
|
requests.push(OwnedToDeviceRequest {
|
||||||
|
|
Loading…
Reference in New Issue