diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-08 15:54:20 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-01-08 15:54:20 +0100 |
commit | 07e2e50928cc0654f3ef1180254be920e2abc136 (patch) | |
tree | 390db4735a328e497616283f46060fb273b7e2b6 /src/imap/mailbox_view.rs | |
parent | 8b5eb25c0cce525f92e29062b76853ee4ad27f62 (diff) | |
download | aerogramme-07e2e50928cc0654f3ef1180254be920e2abc136.tar.gz aerogramme-07e2e50928cc0654f3ef1180254be920e2abc136.zip |
Fetch BODYSTRUCTURE now returns a BODYSTRUCTURE
Diffstat (limited to 'src/imap/mailbox_view.rs')
-rw-r--r-- | src/imap/mailbox_view.rs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs index 3f8389b..027947f 100644 --- a/src/imap/mailbox_view.rs +++ b/src/imap/mailbox_view.rs @@ -1,7 +1,7 @@ use std::num::NonZeroU32; use std::sync::Arc; -use anyhow::{anyhow, Error, Context, Result}; +use anyhow::{anyhow, Context, Error, Result}; use futures::stream::{FuturesOrdered, StreamExt}; @@ -130,7 +130,8 @@ impl MailboxView { data.extend(self.flags_status()?.into_iter()); data.push(self.uidvalidity_status()?); data.push(self.uidnext_status()?); - self.unseen_first_status()?.map(|unseen_status| data.push(unseen_status)); + self.unseen_first_status()? + .map(|unseen_status| data.push(unseen_status)); Ok(data) } @@ -402,18 +403,23 @@ impl MailboxView { } fn unseen_first_status(&self) -> Result<Option<Body<'static>>> { - Ok(self.unseen_first()?.map(|unseen_id| { - Status::ok(None, Some(Code::Unseen(unseen_id)), "First unseen.").map(Body::Status) - }).transpose()?) + Ok(self + .unseen_first()? + .map(|unseen_id| { + Status::ok(None, Some(Code::Unseen(unseen_id)), "First unseen.").map(Body::Status) + }) + .transpose()?) } fn unseen_first(&self) -> Result<Option<NonZeroU32>> { - Ok(self.0.snapshot.table + Ok(self + .0 + .snapshot + .table .values() .enumerate() - .find(|(_i, (_imap_uid, flags))| { - !flags.contains(&"\\Seen".to_string()) - }).map(|(i, _)| NonZeroU32::try_from(i as u32 + 1)) + .find(|(_i, (_imap_uid, flags))| !flags.contains(&"\\Seen".to_string())) + .map(|(i, _)| NonZeroU32::try_from(i as u32 + 1)) .transpose()?) } |