notmuch & server: plumb Delivered-To and X-Original-To headers

This commit is contained in:
2025-02-23 09:37:09 -08:00
parent bc4b15a5aa
commit e6b3a5b5a9
4 changed files with 38 additions and 1 deletions

View File

@@ -773,7 +773,19 @@ impl Query {
for uid in &self.uids {
parts.push(uid.clone());
}
parts.extend(self.remainder.clone());
for r in &self.remainder {
// Rewrite "to:" to include ExtraTo:. ExtraTo: is configured in
// notmuch-config to index Delivered-To and X-Original-To headers.
if r.starts_with("to:") {
parts.push("(".to_string());
parts.push(r.to_string());
parts.push("OR".to_string());
parts.push(r.replace("to:", "ExtraTo:"));
parts.push(")".to_string());
} else {
parts.push(r.to_string());
}
}
parts.join(" ")
}
}