Fetch now support MODSEQ data item
This commit is contained in:
parent
9cec7803d2
commit
f5b73182f2
3 changed files with 12 additions and 7 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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>,
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue