melib/imap: add quoted REFERENCES field in parsing of responses

This commit is contained in:
Manos Pitsidianakis 2021-11-25 17:53:01 +02:00
parent 330a2b20ed
commit d8e9a00563
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

View File

@ -676,6 +676,22 @@ pub fn fetch_response(input: &[u8]) -> ImapParseResult<FetchResponse<'_>> {
String::from_utf8_lossy(&input[i..]) String::from_utf8_lossy(&input[i..])
)))); ))));
} }
} else if input[i..].starts_with(b"BODY[HEADER.FIELDS (\"REFERENCES\")] ") {
i += b"BODY[HEADER.FIELDS (\"REFERENCES\")] ".len();
if let Ok((rest, mut references)) = astring_token(&input[i..]) {
if !references.trim().is_empty() {
if let Ok((_, (_, v))) = crate::email::parser::headers::header(&references) {
references = v;
}
ret.references = Some(references);
}
i += input.len() - i - rest.len();
} else {
return debug!(Err(MeliError::new(format!(
"Unexpected input while parsing UID FETCH response. Got: `{:.40}`",
String::from_utf8_lossy(&input[i..])
))));
}
} else if input[i..].starts_with(b")\r\n") { } else if input[i..].starts_with(b")\r\n") {
i += b")\r\n".len(); i += b")\r\n".len();
break; break;