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 GitHub
parent 0751cc50b9
commit 1632035784
5 changed files with 43 additions and 1 deletions

View File

@@ -113,7 +113,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)]
@@ -390,6 +394,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,
@@ -418,6 +425,7 @@ impl MimeMessage {
is_mime_modified: false,
decoded_data: Vec::new(),
hop_info,
is_bot,
};
match partial {