From 0c6e745d11725b4a15d2c380f5bb60067c26ddd9 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 10 Jan 2024 14:45:36 +0100 Subject: update imap-codec --- src/imap/index.rs | 14 +++++--------- src/imap/mod.rs | 5 +++++ 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/imap/index.rs b/src/imap/index.rs index 95c16b3..da94022 100644 --- a/src/imap/index.rs +++ b/src/imap/index.rs @@ -1,7 +1,7 @@ use std::num::NonZeroU32; use anyhow::{anyhow, Result}; -use imap_codec::imap_types::sequence::{self, SeqOrUid, Sequence, SequenceSet}; +use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet}; use crate::mail::uidindex::{ImapUid, UidIndex}; use crate::mail::unique_ident::UniqueIdent; @@ -61,10 +61,8 @@ impl<'a> Index<'a> { if self.imap_index.is_empty() { return vec![]; } - let iter_strat = sequence::Strategy::Naive { - largest: self.last().expect("The mailbox is not empty").uid, - }; - let mut unroll_seq = sequence_set.iter(iter_strat).collect::>(); + let largest = self.last().expect("The mailbox is not empty").uid; + let mut unroll_seq = sequence_set.iter(largest).collect::>(); unroll_seq.sort(); let start_seq = match unroll_seq.iter().next() { @@ -103,11 +101,9 @@ impl<'a> Index<'a> { if self.imap_index.is_empty() { return Ok(vec![]); } - let iter_strat = sequence::Strategy::Naive { - largest: NonZeroU32::try_from(self.imap_index.len() as u32)?, - }; + let largest = NonZeroU32::try_from(self.imap_index.len() as u32)?; let mut acc = sequence_set - .iter(iter_strat) + .iter(largest) .map(|wanted_id| { self.imap_index .get((wanted_id.get() as usize) - 1) diff --git a/src/imap/mod.rs b/src/imap/mod.rs index 2640183..61a265a 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -175,6 +175,11 @@ async fn client(mut ctx: ClientContext) -> Result<()> { } } }, + flow => { + server.enqueue_status(Status::bye(None, "Unsupported server flow event").unwrap()); + tracing::error!("session task exited for {:?} due to unsupported flow {:?}", ctx.addr, flow); + + } }, // Managing response generated by Aerogramme -- cgit v1.2.3