mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
refactor: flatten handle_auth_require() with let..else
This commit is contained in:
@@ -82,8 +82,11 @@ pub(super) async fn handle_auth_required(
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
message: &MimeMessage,
|
message: &MimeMessage,
|
||||||
) -> Result<HandshakeMessage> {
|
) -> Result<HandshakeMessage> {
|
||||||
match BobState::from_db(&context.sql).await? {
|
let Some(mut bobstate) = BobState::from_db(&context.sql).await? else {
|
||||||
Some(mut bobstate) => match bobstate.handle_message(context, message).await? {
|
return Ok(HandshakeMessage::Ignore);
|
||||||
|
};
|
||||||
|
|
||||||
|
match bobstate.handle_message(context, message).await? {
|
||||||
Some(BobHandshakeStage::Terminated(why)) => {
|
Some(BobHandshakeStage::Terminated(why)) => {
|
||||||
bobstate.notify_aborted(context, why).await?;
|
bobstate.notify_aborted(context, why).await?;
|
||||||
Ok(HandshakeMessage::Done)
|
Ok(HandshakeMessage::Done)
|
||||||
@@ -101,8 +104,6 @@ pub(super) async fn handle_auth_required(
|
|||||||
Ok(HandshakeMessage::Done)
|
Ok(HandshakeMessage::Done)
|
||||||
}
|
}
|
||||||
None => Ok(HandshakeMessage::Ignore),
|
None => Ok(HandshakeMessage::Ignore),
|
||||||
},
|
|
||||||
None => Ok(HandshakeMessage::Ignore),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user