aboutsummaryrefslogtreecommitdiff
path: root/src/mail/uidindex.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-30 12:07:01 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-30 12:07:01 +0200
commit0048b43f27d44133af233f44a3f9d318eabe6694 (patch)
tree723a2158e26dba7864ac39fc5557c15c32e3c162 /src/mail/uidindex.rs
parent497ad4b5eae7a2ddf3d7a945313c478d23414249 (diff)
downloadaerogramme-0048b43f27d44133af233f44a3f9d318eabe6694.tar.gz
aerogramme-0048b43f27d44133af233f44a3f9d318eabe6694.zip
Implement move and copy mail
Diffstat (limited to 'src/mail/uidindex.rs')
-rw-r--r--src/mail/uidindex.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mail/uidindex.rs b/src/mail/uidindex.rs
index 7160ec6..736c763 100644
--- a/src/mail/uidindex.rs
+++ b/src/mail/uidindex.rs
@@ -36,6 +36,7 @@ pub enum UidIndexOp {
MailDel(UniqueIdent),
FlagAdd(UniqueIdent, Vec<Flag>),
FlagDel(UniqueIdent, Vec<Flag>),
+ BumpUidvalidity(u32),
}
impl UidIndex {
@@ -59,6 +60,11 @@ impl UidIndex {
UidIndexOp::FlagDel(ident, flags)
}
+ #[must_use]
+ pub fn op_bump_uidvalidity(&self, count: u32) -> UidIndexOp {
+ UidIndexOp::BumpUidvalidity(count)
+ }
+
// INTERNAL functions to keep state consistent
fn reg_email(&mut self, ident: UniqueIdent, uid: ImapUid, flags: &Vec<Flag>) {
@@ -156,6 +162,9 @@ impl BayouState for UidIndex {
new.idx_by_flag.remove(*uid, rm_flags);
}
}
+ UidIndexOp::BumpUidvalidity(count) => {
+ new.uidvalidity = ImapUidvalidity::new(new.uidvalidity.get() + *count).unwrap_or(ImapUidvalidity::new(u32::MAX).unwrap());
+ }
}
new
}