From 0ee3a0bf79211a85b2acc8cc458423e43fe81dd5 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 22 Jul 2020 11:13:23 +0300 Subject: [PATCH] imap: clear mesage totals when fetching entire mailbox Totals might have been set after a STATUS response, meaning we know the totals without knowing exactly what message UIDs are there. Clear the totals, and start inserting UIDs instead. --- melib/src/backends/imap.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs index 3a099fb2..dbee1fd4 100644 --- a/melib/src/backends/imap.rs +++ b/melib/src/backends/imap.rs @@ -207,6 +207,11 @@ impl MailBackend for ImapType { let mut valid_hash_set: HashSet = HashSet::default(); let mut our_unseen: BTreeSet = Default::default(); Ok(Box::pin(async_stream::try_stream! { + { + let f = &uid_store.mailboxes.lock().await[&mailbox_hash]; + f.exists.lock().unwrap().clear(); + f.unseen.lock().unwrap().clear(); + }; let (cached_hash_set, cached_payload) = fetch_cached_envs(mailbox_hash, &mut our_unseen, &uid_store)?; yield cached_payload; loop {