format code

This commit is contained in:
Quentin 2024-01-19 17:40:08 +01:00
parent c2a518a997
commit f5f3aba8d1
Signed by: quentin
GPG key ID: E9602264D639FF68
5 changed files with 23 additions and 12 deletions

View file

@ -235,9 +235,7 @@ impl<'a> AuthenticatedContext<'a> {
.to_string() .to_string()
.try_into() .try_into()
.map_err(|_| anyhow!("invalid mailbox name"))?; .map_err(|_| anyhow!("invalid mailbox name"))?;
let mut items = vec![FlagNameAttribute::from(Atom::unvalidated( let mut items = vec![FlagNameAttribute::from(Atom::unvalidated("Subscribed"))];
"Subscribed",
))];
if !*is_real { if !*is_real {
items.push(FlagNameAttribute::Noselect); items.push(FlagNameAttribute::Noselect);
} else { } else {

View file

@ -226,7 +226,10 @@ impl<'a> SelectedContext<'a> {
)) ))
} }
async fn expunge(self, uid_sequence_set: &Option<SequenceSet>) -> Result<(Response<'static>, flow::Transition)> { async fn expunge(
self,
uid_sequence_set: &Option<SequenceSet>,
) -> Result<(Response<'static>, flow::Transition)> {
if let Some(failed) = self.fail_read_only() { if let Some(failed) = self.fail_read_only() {
return Ok((failed, flow::Transition::None)); return Ok((failed, flow::Transition::None));
} }

View file

@ -237,20 +237,29 @@ impl MailboxView {
self.update(UpdateParameters::default()).await self.update(UpdateParameters::default()).await
} }
pub async fn expunge(&mut self, maybe_seq_set: &Option<SequenceSet>) -> Result<Vec<Body<'static>>> { pub async fn expunge(
&mut self,
maybe_seq_set: &Option<SequenceSet>,
) -> Result<Vec<Body<'static>>> {
// Get a recent view to apply our change // Get a recent view to apply our change
self.internal.sync().await?; self.internal.sync().await?;
let state = self.internal.peek().await; let state = self.internal.peek().await;
let idx = Index::new(&state)?; let idx = Index::new(&state)?;
// Build a default sequence set for the default case // Build a default sequence set for the default case
use imap_codec::imap_types::sequence::{Sequence, SeqOrUid}; use imap_codec::imap_types::sequence::{SeqOrUid, Sequence};
let seq = match maybe_seq_set { let seq = match maybe_seq_set {
Some(s) => s.clone(), Some(s) => s.clone(),
None => SequenceSet(vec![Sequence::Range(SeqOrUid::Value(NonZeroU32::MIN), SeqOrUid::Asterisk)].try_into().unwrap()), None => SequenceSet(
vec![Sequence::Range(
SeqOrUid::Value(NonZeroU32::MIN),
SeqOrUid::Asterisk,
)]
.try_into()
.unwrap(),
),
}; };
let deleted_flag = Flag::Deleted.to_string(); let deleted_flag = Flag::Deleted.to_string();
let msgs = idx let msgs = idx
.fetch_on_uid(&seq) .fetch_on_uid(&seq)

View file

@ -272,7 +272,9 @@ impl User {
let is_default_mbx_missing = [DRAFTS, ARCHIVE, SENT, TRASH] let is_default_mbx_missing = [DRAFTS, ARCHIVE, SENT, TRASH]
.iter() .iter()
.map(|mbx| list.create_mailbox(mbx)) .map(|mbx| list.create_mailbox(mbx))
.fold(false, |acc, r| acc || matches!(r, CreatedMailbox::Created(..))); .fold(false, |acc, r| {
acc || matches!(r, CreatedMailbox::Created(..))
});
let is_inbox_missing = self.ensure_inbox_exists(&mut list, &row).await?; let is_inbox_missing = self.ensure_inbox_exists(&mut list, &row).await?;
if is_default_mbx_missing && !is_inbox_missing { if is_default_mbx_missing && !is_inbox_missing {
// It's the only case where we created some mailboxes and not saved them // It's the only case where we created some mailboxes and not saved them

View file

@ -241,7 +241,6 @@ fn rfc4551_imapext_condstore() {
.expect("test fully run"); .expect("test fully run");
} }
fn rfc2177_imapext_idle() { fn rfc2177_imapext_idle() {
println!("🧪 rfc2177_imapext_idle"); println!("🧪 rfc2177_imapext_idle");
common::aerogramme_provider_daemon_dev(|imap_socket, lmtp_socket| { common::aerogramme_provider_daemon_dev(|imap_socket, lmtp_socket| {