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.
async
Manos Pitsidianakis 2020-07-22 11:13:23 +03:00
parent 6121f77853
commit 0ee3a0bf79
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 5 additions and 0 deletions

View File

@ -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 {