aboutsummaryrefslogtreecommitdiff
path: root/src/mail
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-13 11:19:08 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-13 11:19:08 +0200
commitfaca15f164c8e2860d27144f75f2dee05742ec6d (patch)
treee81ef9a4360e20685b0f8b2e14ee024119b69fd7 /src/mail
parenta1ca6d9defc844fee52d966951701a57727050c7 (diff)
downloadaerogramme-faca15f164c8e2860d27144f75f2dee05742ec6d.tar.gz
aerogramme-faca15f164c8e2860d27144f75f2dee05742ec6d.zip
LMTP refactoring, implement EXPUNGE
Diffstat (limited to 'src/mail')
-rw-r--r--src/mail/uidindex.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mail/uidindex.rs b/src/mail/uidindex.rs
index 3a3e252..43d6507 100644
--- a/src/mail/uidindex.rs
+++ b/src/mail/uidindex.rs
@@ -214,9 +214,14 @@ impl FlagIndex {
});
}
fn remove(&mut self, uid: ImapUid, flags: &Vec<Flag>) -> () {
- flags.iter().for_each(|flag| {
- self.0.get_mut(flag).and_then(|set| set.remove(&uid));
- });
+ for flag in flags.iter() {
+ if let Some(set) = self.0.get_mut(flag) {
+ set.remove(&uid);
+ if set.is_empty() {
+ self.0.remove(flag);
+ }
+ }
+ }
}
pub fn get(&self, f: &Flag) -> Option<&OrdSet<ImapUid>> {