From f8b09d4537f79fb457c6e424a1e99b09cbc866ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 15 Jun 2021 21:15:11 +0200 Subject: [PATCH] crypto: Remember who started the verification request --- matrix_sdk_crypto/src/verification/requests.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/matrix_sdk_crypto/src/verification/requests.rs b/matrix_sdk_crypto/src/verification/requests.rs index 6ba52aa3..12459b04 100644 --- a/matrix_sdk_crypto/src/verification/requests.rs +++ b/matrix_sdk_crypto/src/verification/requests.rs @@ -70,6 +70,7 @@ pub struct VerificationRequest { flow_id: Arc, other_user_id: Arc, inner: Arc>, + we_started: bool, } impl VerificationRequest { @@ -100,6 +101,7 @@ impl VerificationRequest { flow_id: flow_id.into(), inner, other_user_id: other_user.to_owned().into(), + we_started: true, } } @@ -128,6 +130,7 @@ impl VerificationRequest { flow_id: flow_id.into(), inner, other_user_id: other_user.to_owned().into(), + we_started: true, } } @@ -213,6 +216,11 @@ impl VerificationRequest { self.account.user_id() == self.other_user() } + /// Did we initiate the verification request + pub fn we_started(&self) -> bool { + self.we_started + } + /// Has the verification flow that was started with this request finished. pub fn is_done(&self) -> bool { matches!(&*self.inner.lock().unwrap(), InnerRequest::Done(_)) @@ -284,6 +292,7 @@ impl VerificationRequest { account, other_user_id: sender.to_owned().into(), flow_id: flow_id.into(), + we_started: false, } }