Commit
+17 -0 +/-1 browse
1 | diff --git a/meli/src/accounts.rs b/meli/src/accounts.rs |
2 | index a4cf237..efc3bd8 100644 |
3 | --- a/meli/src/accounts.rs |
4 | +++ b/meli/src/accounts.rs |
5 | @@ -917,6 +917,11 @@ impl Account { |
6 | self.main_loop_handler |
7 | .send(ThreadEvent::UIEvent(UIEvent::StatusEvent(ev))); |
8 | } |
9 | + self.mailbox_entries |
10 | + .entry(mailbox_hash) |
11 | + .and_modify(|entry| { |
12 | + entry.status = MailboxStatus::Parsing(0, 0); |
13 | + }); |
14 | let mailbox_job = self.backend.write().unwrap().fetch(mailbox_hash); |
15 | match mailbox_job { |
16 | Ok(mailbox_job) => { |
17 | @@ -1439,6 +1444,7 @@ impl Account { |
18 | .into_iter() |
19 | .map(|e| (e.hash(), e)) |
20 | .collect::<HashMap<EnvelopeHash, Envelope>>(); |
21 | + let len = envelopes.len(); |
22 | if let Some(updated_mailboxes) = self.collection.merge( |
23 | envelopes, |
24 | mailbox_hash, |
25 | @@ -1450,6 +1456,17 @@ impl Account { |
26 | )); |
27 | } |
28 | } |
29 | + self.mailbox_entries |
30 | + .entry(mailbox_hash) |
31 | + .and_modify(|entry| { |
32 | + let prev_len = |
33 | + if let MailboxStatus::Parsing(prev_len, _) = entry.status { |
34 | + prev_len |
35 | + } else { |
36 | + 0 |
37 | + }; |
38 | + entry.status = MailboxStatus::Parsing(prev_len + len, 0); |
39 | + }); |
40 | self.main_loop_handler.send(ThreadEvent::UIEvent( |
41 | UIEvent::MailboxUpdate((self.hash, mailbox_hash)), |
42 | )); |