mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 06:16:30 +03:00
Use PartialEq on SecureJoinStep
This commit is contained in:
@@ -98,7 +98,7 @@ pub(crate) struct Bob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The next message expected by [Bob] in the setup-contact/secure-join protocol.
|
/// The next message expected by [Bob] in the setup-contact/secure-join protocol.
|
||||||
#[derive(Debug)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum SecureJoinStep {
|
enum SecureJoinStep {
|
||||||
/// No setup-contact protocol running.
|
/// No setup-contact protocol running.
|
||||||
NotActive,
|
NotActive,
|
||||||
@@ -573,7 +573,7 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
let bob = context.bob.read().await;
|
let bob = context.bob.read().await;
|
||||||
let scan = bob.qr_scan.as_ref();
|
let scan = bob.qr_scan.as_ref();
|
||||||
scan.is_none()
|
scan.is_none()
|
||||||
|| !matches!(bob.expects, SecureJoinStep::AuthRequired)
|
|| bob.expects != SecureJoinStep::AuthRequired
|
||||||
|| join_vg && scan.unwrap().state != LotState::QrAskVerifyGroup
|
|| join_vg && scan.unwrap().state != LotState::QrAskVerifyGroup
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -761,10 +761,7 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
HandshakeMessage::Ignore
|
HandshakeMessage::Ignore
|
||||||
};
|
};
|
||||||
|
|
||||||
if !matches!(
|
if context.bob.read().await.expects != SecureJoinStep::ContactConfirm {
|
||||||
context.bob.read().await.expects,
|
|
||||||
SecureJoinStep::ContactConfirm
|
|
||||||
) {
|
|
||||||
info!(context, "Message belongs to a different handshake.",);
|
info!(context, "Message belongs to a different handshake.",);
|
||||||
return Ok(abort_retval);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user