melib/mbox: fix not updating mailbox_index on new envelope

master
Manos Pitsidianakis 2020-07-14 23:17:41 +03:00
parent e1c9967260
commit 08c462801d
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 4 additions and 1 deletions

View File

@ -740,6 +740,7 @@ impl MailBackend for MboxType {
hasher.finish() hasher.finish()
}; };
let mailboxes = self.mailboxes.clone(); let mailboxes = self.mailboxes.clone();
let mailbox_index = self.mailbox_index.clone();
let prefer_mbox_type = self.prefer_mbox_type; let prefer_mbox_type = self.prefer_mbox_type;
let handle = std::thread::Builder::new() let handle = std::thread::Builder::new()
.name(format!("watching {}", self.account_name,)) .name(format!("watching {}", self.account_name,))
@ -788,11 +789,13 @@ impl MailBackend for MboxType {
{ {
if let Ok((_, envelopes)) = mbox_parse( if let Ok((_, envelopes)) = mbox_parse(
mailbox_lock[&mailbox_hash].index.clone(), mailbox_lock[&mailbox_hash].index.clone(),
&contents[mailbox_lock[&mailbox_hash].content.len()..], &contents,
mailbox_lock[&mailbox_hash].content.len(), mailbox_lock[&mailbox_hash].content.len(),
prefer_mbox_type, prefer_mbox_type,
) { ) {
let mut mailbox_index_lck = mailbox_index.lock().unwrap();
for env in envelopes { for env in envelopes {
mailbox_index_lck.insert(env.hash(), mailbox_hash);
sender.send(RefreshEvent { sender.send(RefreshEvent {
account_hash, account_hash,
mailbox_hash, mailbox_hash,