melib/imap/untagged: lower mbox count on EXPUNGE events

jmap-eventsource
Manos Pitsidianakis 2020-10-13 21:17:27 +03:00
parent 6f31388b27
commit 535d04f4f0
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 13 additions and 8 deletions

View File

@ -107,6 +107,8 @@ impl ImapConnection {
Some(v) => v, Some(v) => v,
None => return Ok(true), None => return Ok(true),
}; };
mailbox.exists.lock().unwrap().remove(deleted_hash);
mailbox.unseen.lock().unwrap().remove(deleted_hash);
self.uid_store self.uid_store
.hash_index .hash_index
.lock() .lock()
@ -388,19 +390,22 @@ impl ImapConnection {
} }
}; };
debug!("fetch uid {} {:?}", uid, flags); debug!("fetch uid {} {:?}", uid, flags);
let env_hash = self if let Some(env_hash) = {
.uid_store let temp = self
.uid_index .uid_store
.lock() .uid_index
.unwrap() .lock()
.get(&(mailbox_hash, uid)) .unwrap()
.copied(); .get(&(mailbox_hash, uid))
if let Some(env_hash) = env_hash { .copied();
temp
} {
if !flags.0.intersects(crate::email::Flag::SEEN) { if !flags.0.intersects(crate::email::Flag::SEEN) {
mailbox.unseen.lock().unwrap().insert_new(env_hash); mailbox.unseen.lock().unwrap().insert_new(env_hash);
} else { } else {
mailbox.unseen.lock().unwrap().remove(env_hash); mailbox.unseen.lock().unwrap().remove(env_hash);
} }
mailbox.exists.lock().unwrap().insert_new(env_hash);
if let Some(modseq) = modseq { if let Some(modseq) = modseq {
self.uid_store self.uid_store
.modseq .modseq