display failed messages

This commit is contained in:
B. Petersen
2019-11-02 00:34:14 +01:00
parent ec8dbddcfb
commit c63fbf199a
2 changed files with 20 additions and 7 deletions

View File

@@ -117,11 +117,24 @@ impl<'a> MimeParser<'a> {
); );
if r == MAILIMF_NO_ERROR as libc::c_int && !self.mimeroot.is_null() { if r == MAILIMF_NO_ERROR as libc::c_int && !self.mimeroot.is_null() {
let (encrypted, signatures, gossipped_addr) = match e2ee::try_decrypt(self.context, self.mimeroot) {
e2ee::try_decrypt(self.context, self.mimeroot)?; Ok((encrypted, signatures, gossipped_addr)) => {
self.encrypted = encrypted; self.encrypted = encrypted;
self.signatures = signatures; self.signatures = signatures;
self.gossipped_addr = gossipped_addr; 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); self.parse_mime_recursive(self.mimeroot);
if let Some(field) = self.lookup_field("Subject") { if let Some(field) = self.lookup_field("Subject") {

View File

@@ -65,12 +65,12 @@ pub unsafe fn dc_receive_imf(
let mut mime_parser = MimeParser::new(context); let mut mime_parser = MimeParser::new(context);
if let Err(err) = mime_parser.parse(imf_raw) { 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() { if mime_parser.header.is_empty() {
// Error - even adding an empty record won't help as we do not know the message ID // 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; return;
} }