Skip to content

Commit

Permalink
try to see if we just always need to return the UID
Browse files Browse the repository at this point in the history
  • Loading branch information
MTRNord committed Jul 27, 2023
1 parent dba0984 commit 4e1b2b4
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions crates/erooster_imap/src/commands/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,20 @@ impl Fetch<'_> {
Ok((_, args)) => {
debug!("Parsed Fetch args: {:?}", args);
for mut mail in filtered_mails {
let uid = mail.uid();
let uid: i64 = mail.uid();
let sequence =
mail.sequence_number().context("Sequence number missing")?;
if let Some(resp) = generate_response(args.clone(), &mut mail)? {
if is_uid {
if resp.contains("UID") {
lines
.feed(format!("* {sequence} FETCH ({resp})"))
.await?;
} else {
lines
.feed(format!(
"* {sequence} FETCH (UID {uid} {resp})"
))
.await?;
}
// if resp.contains("UID") {
// lines
// .feed(format!("* {sequence} FETCH ({resp})"))
// .await?;
// } else {
lines
.feed(format!("* {sequence} FETCH (UID {uid} {resp})"))
.await?;
// }
} else {
lines.feed(format!("* {sequence} FETCH ({resp})")).await?;
}
Expand Down Expand Up @@ -300,11 +298,9 @@ fn generate_response_for_attributes(
}
FetchAttributes::Uid => Ok(Some(format!("UID {}", mail.uid()))),
FetchAttributes::BodySection(section_text, range) => {
Ok(Some(body(section_text, range, mail, true)))
}
FetchAttributes::BodyPeek(section_text, range) => {
Ok(Some(body(section_text, range, mail, false)))
Ok(Some(body(section_text, range, mail)))
}
FetchAttributes::BodyPeek(section_text, range) => Ok(Some(body(section_text, range, mail))),
_ => Ok(None),
}
}
Expand All @@ -315,7 +311,6 @@ fn body(
section_text: Option<SectionText>,
range: Option<(u64, u64)>,
mail: &mut MailEntryType,
seen: bool,
) -> String {
if let Some(section_text) = section_text {
match section_text {
Expand Down

0 comments on commit 4e1b2b4

Please sign in to comment.