mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
mimeparser: parse hidden headers
This commit is contained in:
@@ -149,7 +149,7 @@ impl MimeMessage {
|
|||||||
let mut from = Default::default();
|
let mut from = Default::default();
|
||||||
let mut chat_disposition_notification_to = None;
|
let mut chat_disposition_notification_to = None;
|
||||||
|
|
||||||
// init known headers with what mailparse provided us
|
// Parse IMF headers.
|
||||||
MimeMessage::merge_headers(
|
MimeMessage::merge_headers(
|
||||||
context,
|
context,
|
||||||
&mut headers,
|
&mut headers,
|
||||||
@@ -159,6 +159,21 @@ impl MimeMessage {
|
|||||||
&mail.headers,
|
&mail.headers,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Parse hidden headers.
|
||||||
|
let mimetype = mail.ctype.mimetype.parse::<Mime>()?;
|
||||||
|
if mimetype.type_() == mime::MULTIPART && mimetype.subtype().as_str() == "mixed" {
|
||||||
|
if let Some(part) = mail.subparts.first() {
|
||||||
|
for field in &part.headers {
|
||||||
|
let key = field.get_key().to_lowercase();
|
||||||
|
|
||||||
|
// For now only Chat-User-Avatar can be hidden.
|
||||||
|
if !headers.contains_key(&key) && key == "chat-user-avatar" {
|
||||||
|
headers.insert(key.to_string(), field.get_value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove headers that are allowed _only_ in the encrypted part
|
// remove headers that are allowed _only_ in the encrypted part
|
||||||
headers.remove("secure-join-fingerprint");
|
headers.remove("secure-join-fingerprint");
|
||||||
headers.remove("chat-verified");
|
headers.remove("chat-verified");
|
||||||
|
|||||||
Reference in New Issue
Block a user