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