From 1760740a4c9d11c1b42e39ef61cc741c9b3e8a97 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 13 Apr 2020 23:10:30 +0300 Subject: [PATCH] Parse inline attachments from non-DC email clients Some mobile email clients, such as apple mail, attach or inline images after description, just like Delta Chat. It is better to display them instead of ignoring. --- src/mimeparser.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mimeparser.rs b/src/mimeparser.rs index e498e1453..36bec66e1 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -203,10 +203,6 @@ impl MimeMessage { /// Delta Chat sends attachments, such as images, in two-part messages, with the first message /// containing an explanation. If such a message is detected, first part can be safely dropped. fn squash_attachment_parts(&mut self) { - if !self.has_chat_version() { - return; - } - if let [textpart, filepart] = &self.parts[..] { let need_drop = { textpart.typ == Viewtype::Text @@ -1509,6 +1505,8 @@ MDYyMDYxNTE1RTlDOEE4Cj4+CnN0YXJ0eHJlZgo4Mjc4CiUlRU9GCg== Some("Mail with inline attachment".to_string()) ); - assert_eq!(message.parts.len(), 2); + assert_eq!(message.parts.len(), 1); + assert_eq!(message.parts[0].typ, Viewtype::File); + assert_eq!(message.parts[0].msg, "Hello!"); } }