aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-10 18:08:44 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-10 18:08:44 +0100
commitf5b73182f25dfdcdc34f7b3c6664c5112ce93c1c (patch)
treea7f30a470d1aa057121a824e0557e528c3751518
parent9cec7803d28617f1bfd1ac1621c2eda9582201d4 (diff)
downloadaerogramme-f5b73182f25dfdcdc34f7b3c6664c5112ce93c1c.tar.gz
aerogramme-f5b73182f25dfdcdc34f7b3c6664c5112ce93c1c.zip
Fetch now support MODSEQ data item
-rw-r--r--Cargo.lock4
-rw-r--r--src/imap/index.rs10
-rw-r--r--src/imap/mail_view.rs5
3 files changed, 12 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e2992b7..2f9e5b4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1807,7 +1807,7 @@ dependencies = [
[[package]]
name = "imap-codec"
version = "2.0.0"
-source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#eb37f06a0e8d2543f60063ec80cde9e9dcb150f1"
+source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
dependencies = [
"abnf-core",
"base64 0.21.5",
@@ -1834,7 +1834,7 @@ dependencies = [
[[package]]
name = "imap-types"
version = "2.0.0"
-source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#eb37f06a0e8d2543f60063ec80cde9e9dcb150f1"
+source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
dependencies = [
"base64 0.21.5",
"bounded-static",
diff --git a/src/imap/index.rs b/src/imap/index.rs
index da94022..44109d5 100644
--- a/src/imap/index.rs
+++ b/src/imap/index.rs
@@ -3,7 +3,7 @@ use std::num::NonZeroU32;
use anyhow::{anyhow, Result};
use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet};
-use crate::mail::uidindex::{ImapUid, UidIndex};
+use crate::mail::uidindex::{ImapUid, ModSeq, UidIndex};
use crate::mail::unique_ident::UniqueIdent;
pub struct Index<'a> {
@@ -17,12 +17,10 @@ impl<'a> Index<'a> {
.iter()
.enumerate()
.map(|(i_enum, (&uid, &uuid))| {
- let flags = internal
+ let (_, modseq, flags) = internal
.table
.get(&uuid)
- .ok_or(anyhow!("mail is missing from index"))?
- .2
- .as_ref();
+ .ok_or(anyhow!("mail is missing from index"))?;
let i_int: u32 = (i_enum + 1).try_into()?;
let i: NonZeroU32 = i_int.try_into()?;
@@ -30,6 +28,7 @@ impl<'a> Index<'a> {
i,
uid,
uuid,
+ modseq: *modseq,
flags,
})
})
@@ -134,6 +133,7 @@ pub struct MailIndex<'a> {
pub i: NonZeroU32,
pub uid: ImapUid,
pub uuid: UniqueIdent,
+ pub modseq: ModSeq,
pub flags: &'a Vec<String>,
}
diff --git a/src/imap/mail_view.rs b/src/imap/mail_view.rs
index eeb6b4b..a8db733 100644
--- a/src/imap/mail_view.rs
+++ b/src/imap/mail_view.rs
@@ -90,6 +90,7 @@ impl<'a> MailView<'a> {
Ok(body)
}
MessageDataItemName::InternalDate => self.internal_date(),
+ MessageDataItemName::ModSeq => Ok(self.modseq()),
})
.collect::<Result<Vec<_>, _>>()?;
@@ -252,6 +253,10 @@ impl<'a> MailView<'a> {
.ok_or(anyhow!("Unable to parse internal date"))?;
Ok(MessageDataItem::InternalDate(DateTime::unvalidated(dt)))
}
+
+ fn modseq(&self) -> MessageDataItem<'static> {
+ MessageDataItem::ModSeq(self.in_idx.modseq)
+ }
}
pub enum SeenFlag {