aboutsummaryrefslogtreecommitdiff
path: root/src/mail/mailbox.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-30 13:33:58 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-30 14:03:12 +0200
commit89b588338700d13e34b50836cb790c0e0d588a28 (patch)
tree2a036387a866ffaa97817dded8fa6649c83c6460 /src/mail/mailbox.rs
parent0f0a8d415e45df178778260d3be1b83ab2785675 (diff)
downloadaerogramme-89b588338700d13e34b50836cb790c0e0d588a28.tar.gz
aerogramme-89b588338700d13e34b50836cb790c0e0d588a28.zip
Elementary data structure for mailbox list
Diffstat (limited to 'src/mail/mailbox.rs')
-rw-r--r--src/mail/mailbox.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mail/mailbox.rs b/src/mail/mailbox.rs
index dd0d5da..643a869 100644
--- a/src/mail/mailbox.rs
+++ b/src/mail/mailbox.rs
@@ -22,13 +22,18 @@ pub struct Mailbox {
}
impl Mailbox {
- pub(super) async fn open(creds: &Credentials, id: UniqueIdent) -> Result<Self> {
+ pub(super) async fn open(creds: &Credentials, id: UniqueIdent, min_uidvalidity: ImapUidvalidity) -> Result<Self> {
let index_path = format!("index/{}", id);
let mail_path = format!("mail/{}", id);
let mut uid_index = Bayou::<UidIndex>::new(creds, index_path)?;
uid_index.sync().await?;
+ let uidvalidity = uid_index.state().uidvalidity;
+ if uidvalidity < min_uidvalidity {
+ uid_index.push(uid_index.state().op_bump_uidvalidity(min_uidvalidity.get() - uidvalidity.get())).await?;
+ }
+
let mbox = RwLock::new(MailboxInternal {
id,
bucket: creds.bucket().to_string(),