diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 602a1a6f3..d31e7dc02 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -117,11 +117,24 @@ impl<'a> MimeParser<'a> { ); if r == MAILIMF_NO_ERROR as libc::c_int && !self.mimeroot.is_null() { - let (encrypted, signatures, gossipped_addr) = - e2ee::try_decrypt(self.context, self.mimeroot)?; - self.encrypted = encrypted; - self.signatures = signatures; - self.gossipped_addr = gossipped_addr; + match e2ee::try_decrypt(self.context, self.mimeroot) { + Ok((encrypted, signatures, gossipped_addr)) => { + self.encrypted = encrypted; + self.signatures = signatures; + self.gossipped_addr = gossipped_addr; + } + Err(err) => { + // continue with the current, still encrypted, mime tree. + // unencrypted parts will be replaced by an error message + // that is added as "the message" to the chat then. + // + // if we just return here, the header is missing + // and the caller cannot display the message + // and try to assign the message to a chat + warn!(self.context, "decryption failed: {}", err); + } + } + self.parse_mime_recursive(self.mimeroot); if let Some(field) = self.lookup_field("Subject") { diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 7f4c0bf6c..0690be868 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -65,12 +65,12 @@ pub unsafe fn dc_receive_imf( let mut mime_parser = MimeParser::new(context); if let Err(err) = mime_parser.parse(imf_raw) { - error!(context, "dc_receive_imf parse error: {}", err); + warn!(context, "dc_receive_imf parse error: {}", err); }; if mime_parser.header.is_empty() { // Error - even adding an empty record won't help as we do not know the message ID - info!(context, "No header."); + warn!(context, "No header."); return; }