diff options
Diffstat (limited to 'src/mail/mailbox.rs')
-rw-r--r-- | src/mail/mailbox.rs | 7 |
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(), |