melib/imap: FETCH comma-sep list on untagged Recent response

FETCHing RECENT messages when receiving an untagged RECENT response from
the server didn't separate the message numbers with comma but with
space, which is invalid.
jmap-eventsource
Manos Pitsidianakis 2020-09-18 12:10:44 +03:00
parent 9bafba3905
commit 3004789f32
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 10 additions and 4 deletions

View File

@ -241,12 +241,18 @@ impl ImapConnection {
debug!("UID SEARCH RECENT returned no results");
}
Ok(v) => {
let command = {
let mut iter = v.split(u8::is_ascii_whitespace);
let first = iter.next().unwrap_or(v);
let mut accum = format!("{}", to_str!(first).trim());
for ms in iter {
accum = format!("{},{}", accum, to_str!(ms).trim());
}
format!("UID FETCH {} (FLAGS RFC822)", accum)
};
try_fail!(
mailbox_hash,
self.send_command(
&[b"UID FETCH", v, b"(FLAGS RFC822)"]
.join(&b' '),
).await
self.send_command(command.as_bytes()).await
self.read_response(&mut response, RequiredResponses::FETCH_REQUIRED).await
);
debug!(&response);