imap: early return on empty mailbox in get()

async
Manos Pitsidianakis 2020-06-22 17:22:34 +03:00
parent af4ad19169
commit 7d359624fe
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 7 additions and 2 deletions

View File

@ -312,7 +312,6 @@ impl MailBackend for ImapType {
"mailbox: {} examine_response: {:?}",
mailbox_path, examine_response
);
let mut exists: usize = examine_response.uidnext - 1;
{
let mut uidvalidities = uid_store.uidvalidity.lock().unwrap();
@ -336,8 +335,14 @@ impl MailBackend for ImapType {
permissions.delete_messages = !examine_response.read_only;
permissions.delete_messages = !examine_response.read_only;
let mut mailbox_exists = mailbox_exists.lock().unwrap();
*mailbox_exists = exists;
*mailbox_exists = examine_response.exists;
}
if examine_response.exists == 0 {
tx.send(AsyncStatus::Payload(Ok(Vec::new()))).unwrap();
tx.send(AsyncStatus::Finished).unwrap();
return Ok(());
}
let mut exists: usize = examine_response.exists;
/* reselecting the same mailbox with EXAMINE prevents expunging it */
conn.examine_mailbox(mailbox_hash, &mut response)?;