diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-18 12:12:14 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-09-18 12:12:14 +0300 |
commit | 38eff71971ae7b008782f172aa5b2ba3492e6017 (patch) | |
tree | c16796dca5205827eaf03593a8ed9776a8117272 /melib/src/backends | |
parent | 3004789f32f51a703422378dd75ad966deeec3c2 (diff) |
IMAP: don't show \Recent flag as tag
Closes #74
Diffstat (limited to 'melib/src/backends')
-rw-r--r-- | melib/src/backends/imap/protocol_parser.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/melib/src/backends/imap/protocol_parser.rs b/melib/src/backends/imap/protocol_parser.rs index b4c5d6be..c014bee1 100644 --- a/melib/src/backends/imap/protocol_parser.rs +++ b/melib/src/backends/imap/protocol_parser.rs @@ -1121,7 +1121,8 @@ pub fn flags(input: &[u8]) -> IResult<&[u8], (Flag, Vec<String>)> { let mut input = input; while !input.starts_with(b")") && !input.is_empty() { - if input.starts_with(b"\\") { + let is_system_flag = input.starts_with(b"\\"); + if is_system_flag { input = &input[1..]; } let mut match_end = 0; @@ -1132,23 +1133,24 @@ pub fn flags(input: &[u8]) -> IResult<&[u8], (Flag, Vec<String>)> { match_end += 1; } - match &input[..match_end] { - b"Answered" => { + match (is_system_flag, &input[..match_end]) { + (true, t) if t.eq_ignore_ascii_case(b"Answered") => { ret.set(Flag::REPLIED, true); } - b"Flagged" => { + (true, t) if t.eq_ignore_ascii_case(b"Flagged") => { ret.set(Flag::FLAGGED, true); } - b"Deleted" => { + (true, t) if t.eq_ignore_ascii_case(b"Deleted") => { ret.set(Flag::TRASHED, true); } - b"Seen" => { + (true, t) if t.eq_ignore_ascii_case(b"Seen") => { ret.set(Flag::SEEN, true); } - b"Draft" => { + (true, t) if t.eq_ignore_ascii_case(b"Draft") => { ret.set(Flag::DRAFT, true); } - f => { + (true, t) if t.eq_ignore_ascii_case(b"Recent") => { /* ignore */ } + (_, f) => { keywords.push(String::from_utf8_lossy(&f).into()); } } |