Browse Source

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.
master
Manos Pitsidianakis 2 years ago
parent
commit
0ee3a0bf79
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 5
      melib/src/backends/imap.rs

5
melib/src/backends/imap.rs

@ -207,6 +207,11 @@ impl MailBackend for ImapType {
let mut valid_hash_set: HashSet<EnvelopeHash> = HashSet::default();
let mut our_unseen: BTreeSet<EnvelopeHash> = 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 {

Loading…
Cancel
Save