crypto: Add a method to get all verification requests of a certain user
parent
d212e7df18
commit
34703bc0d6
|
@ -731,6 +731,11 @@ impl OlmMachine {
|
||||||
self.verification_machine.get_request(user_id, flow_id)
|
self.verification_machine.get_request(user_id, flow_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get all the verification requests of a given user.
|
||||||
|
pub fn get_verification_requests(&self, user_id: &UserId) -> Vec<VerificationRequest> {
|
||||||
|
self.verification_machine.get_requests(user_id)
|
||||||
|
}
|
||||||
|
|
||||||
async fn update_one_time_key_count(&self, key_count: &BTreeMap<DeviceKeyAlgorithm, UInt>) {
|
async fn update_one_time_key_count(&self, key_count: &BTreeMap<DeviceKeyAlgorithm, UInt>) {
|
||||||
self.account.update_uploaded_key_count(key_count).await;
|
self.account.update_uploaded_key_count(key_count).await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,13 @@ impl VerificationMachine {
|
||||||
self.requests.get(user_id).and_then(|v| v.get(flow_id.as_ref()).map(|s| s.clone()))
|
self.requests.get(user_id).and_then(|v| v.get(flow_id.as_ref()).map(|s| s.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_requests(&self, user_id: &UserId) -> Vec<VerificationRequest> {
|
||||||
|
self.requests
|
||||||
|
.get(user_id)
|
||||||
|
.map(|v| v.iter().map(|i| i.value().clone()).collect())
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
fn insert_request(&self, request: VerificationRequest) {
|
fn insert_request(&self, request: VerificationRequest) {
|
||||||
self.requests
|
self.requests
|
||||||
.entry(request.other_user().to_owned())
|
.entry(request.other_user().to_owned())
|
||||||
|
|
Loading…
Reference in New Issue