server: send tags on each message in thread

This commit is contained in:
Bill Thiede 2023-12-10 17:26:04 -08:00
parent d2cf270dda
commit fa7df55b0e

View File

@ -67,6 +67,7 @@ pub struct Message {
// On disk location of message
pub path: String,
pub attachments: Vec<Attachment>,
pub tags: Vec<String>,
}
// Content-Type: image/jpeg; name="PXL_20231125_204826860.jpg"
@ -314,6 +315,12 @@ impl QueryRoot {
let mut messages = Vec::new();
for (path, id) in std::iter::zip(nm.files(&thread_id)?, nm.message_ids(&thread_id)?) {
info!("{id}\nfile: {path}");
let msg = nm.show(&format!("id:{id}"))?;
let tags = msg.0[0].0[0]
.0
.as_ref()
.map(|m| m.tags.clone())
.unwrap_or_else(Vec::default);
let file = File::open(&path)?;
let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = parse_mail(&mmap)?;
@ -372,6 +379,7 @@ impl QueryRoot {
to,
cc,
subject,
tags,
timestamp,
headers,
body,