feat: add bot field to contact (#4821)

closes #4647
This commit is contained in:
Sebastian Klähn
2023-10-15 12:40:32 +02:00
committed by link2xt
parent ac557f73b3
commit e725bdfb2b
5 changed files with 43 additions and 1 deletions

View File

@@ -114,7 +114,11 @@ pub(crate) struct MimeMessage {
/// for e.g. late-parsing HTML.
pub decoded_data: Vec<u8>,
/// Hop info for debugging.
pub(crate) hop_info: String,
/// Whether the contact sending this should be marked as bot.
pub(crate) is_bot: bool,
}
#[derive(Debug, PartialEq)]
@@ -373,6 +377,9 @@ impl MimeMessage {
signatures.clear();
}
// Auto-submitted is also set by holiday-notices so we also check `chat-version`
let is_bot = headers.contains_key("auto-submitted") && headers.contains_key("chat-version");
let mut parser = MimeMessage {
parts: Vec::new(),
headers,
@@ -401,6 +408,7 @@ impl MimeMessage {
is_mime_modified: false,
decoded_data: Vec::new(),
hop_info,
is_bot,
};
match partial {