IMAP: don't show \Recent flag as tag

Closes #74
jmap-eventsource
Manos Pitsidianakis 2020-09-18 12:12:14 +03:00
parent 3004789f32
commit 38eff71971
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 10 additions and 8 deletions

View File

@ -1121,7 +1121,8 @@ pub fn flags(input: &[u8]) -> IResult<&[u8], (Flag, Vec<String>)> {
let mut input = input; let mut input = input;
while !input.starts_with(b")") && !input.is_empty() { 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..]; input = &input[1..];
} }
let mut match_end = 0; let mut match_end = 0;
@ -1132,23 +1133,24 @@ pub fn flags(input: &[u8]) -> IResult<&[u8], (Flag, Vec<String>)> {
match_end += 1; match_end += 1;
} }
match &input[..match_end] { match (is_system_flag, &input[..match_end]) {
b"Answered" => { (true, t) if t.eq_ignore_ascii_case(b"Answered") => {
ret.set(Flag::REPLIED, true); ret.set(Flag::REPLIED, true);
} }
b"Flagged" => { (true, t) if t.eq_ignore_ascii_case(b"Flagged") => {
ret.set(Flag::FLAGGED, true); ret.set(Flag::FLAGGED, true);
} }
b"Deleted" => { (true, t) if t.eq_ignore_ascii_case(b"Deleted") => {
ret.set(Flag::TRASHED, true); ret.set(Flag::TRASHED, true);
} }
b"Seen" => { (true, t) if t.eq_ignore_ascii_case(b"Seen") => {
ret.set(Flag::SEEN, true); ret.set(Flag::SEEN, true);
} }
b"Draft" => { (true, t) if t.eq_ignore_ascii_case(b"Draft") => {
ret.set(Flag::DRAFT, true); 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()); keywords.push(String::from_utf8_lossy(&f).into());
} }
} }