diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-18 12:08:02 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-18 12:08:02 +0300 |
commit | 98949a4a722034d6e83311b6e9166865afa542de (patch) | |
tree | 65c71425051854ba219d6b31dab42f51e4458a9d | |
parent | fbf2b7dc7bf53754f27aecaeab45a88eb276110d (diff) |
melib/imap: expand special mailbox detection cases
-rw-r--r-- | melib/src/backends/imap.rs | 5 | ||||
-rw-r--r-- | melib/src/backends/imap/protocol_parser.rs | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs index 39cc2e74..beda1507 100644 --- a/melib/src/backends/imap.rs +++ b/melib/src/backends/imap.rs @@ -1443,6 +1443,11 @@ impl ImapType { for l in lines { if let Ok(subscription) = protocol_parser::list_mailbox_result(&l).map(|(_, v)| v) { if let Some(f) = mailboxes.get_mut(&subscription.hash()) { + if f.special_usage() == SpecialUsageMailbox::Normal + && subscription.special_usage() != SpecialUsageMailbox::Normal + { + f.set_special_usage(subscription.special_usage())?; + } f.is_subscribed = true; } } else { diff --git a/melib/src/backends/imap/protocol_parser.rs b/melib/src/backends/imap/protocol_parser.rs index f467b96d..0aaf8bcf 100644 --- a/melib/src/backends/imap/protocol_parser.rs +++ b/melib/src/backends/imap/protocol_parser.rs @@ -425,9 +425,15 @@ pub fn list_mailbox_result(input: &[u8]) -> IResult<&[u8], ImapMailbox> { } else if p.eq_ignore_ascii_case(b"\\Sent") { let _ = f.set_special_usage(SpecialUsageMailbox::Sent); } else if p.eq_ignore_ascii_case(b"\\Junk") { + let _ = f.set_special_usage(SpecialUsageMailbox::Junk); + } else if p.eq_ignore_ascii_case(b"\\Trash") { let _ = f.set_special_usage(SpecialUsageMailbox::Trash); } else if p.eq_ignore_ascii_case(b"\\Drafts") { let _ = f.set_special_usage(SpecialUsageMailbox::Drafts); + } else if p.eq_ignore_ascii_case(b"\\Flagged") { + let _ = f.set_special_usage(SpecialUsageMailbox::Flagged); + } else if p.eq_ignore_ascii_case(b"\\Archive") { + let _ = f.set_special_usage(SpecialUsageMailbox::Archive); } } f.imap_path = path.to_string(); |