melib/imap: on set_flags, update {un,}seen sets in all mailboxes
Some envelopes might be in several mailboxes, for example in Gmail's implementation of IMAP.pull/237/head
parent
363f493099
commit
f5cfbd32e6
|
@ -793,12 +793,13 @@ impl MailBackend for ImapType {
|
|||
conn.read_response(&mut response, RequiredResponses::empty())
|
||||
.await?;
|
||||
if set_seen {
|
||||
let f = &uid_store.mailboxes.lock().await[&mailbox_hash];
|
||||
if let Ok(mut unseen) = f.unseen.lock() {
|
||||
for env_hash in env_hashes.iter() {
|
||||
unseen.remove(env_hash);
|
||||
}
|
||||
};
|
||||
for f in uid_store.mailboxes.lock().await.values() {
|
||||
if let Ok(mut unseen) = f.unseen.lock() {
|
||||
for env_hash in env_hashes.iter() {
|
||||
unseen.remove(env_hash);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if flags.iter().any(|(_, b)| !*b) {
|
||||
|
@ -858,12 +859,13 @@ impl MailBackend for ImapType {
|
|||
conn.read_response(&mut response, RequiredResponses::empty())
|
||||
.await?;
|
||||
if set_unseen {
|
||||
let f = &uid_store.mailboxes.lock().await[&mailbox_hash];
|
||||
if let Ok(mut unseen) = f.unseen.lock() {
|
||||
for env_hash in env_hashes.iter() {
|
||||
unseen.insert_new(env_hash);
|
||||
}
|
||||
};
|
||||
for f in uid_store.mailboxes.lock().await.values() {
|
||||
if let Ok(mut unseen) = f.unseen.lock() {
|
||||
for env_hash in env_hashes.iter() {
|
||||
unseen.insert_new(env_hash);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue