mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 08:16:32 +03:00
cargo fmt
This commit is contained in:
@@ -598,60 +598,60 @@ impl MimeMessage {
|
|||||||
let old_part_count = self.parts.len();
|
let old_part_count = self.parts.len();
|
||||||
|
|
||||||
match filename {
|
match filename {
|
||||||
Some(filename) => {
|
Some(filename) => {
|
||||||
self.do_add_single_file_part(
|
self.do_add_single_file_part(
|
||||||
context,
|
context,
|
||||||
msg_type,
|
msg_type,
|
||||||
mime_type,
|
mime_type,
|
||||||
&raw_mime,
|
&raw_mime,
|
||||||
&mail.get_body_raw()?,
|
&mail.get_body_raw()?,
|
||||||
&filename,
|
&filename,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
match mime_type.type_() {
|
match mime_type.type_() {
|
||||||
mime::IMAGE | mime::AUDIO | mime::VIDEO | mime::APPLICATION => {
|
mime::IMAGE | mime::AUDIO | mime::VIDEO | mime::APPLICATION => {
|
||||||
warn!(context, "Missing attachment");
|
warn!(context, "Missing attachment");
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
mime::TEXT | mime::HTML => {
|
mime::TEXT | mime::HTML => {
|
||||||
let decoded_data = match mail.get_body() {
|
let decoded_data = match mail.get_body() {
|
||||||
Ok(decoded_data) => decoded_data,
|
Ok(decoded_data) => decoded_data,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(context, "Invalid body parsed {:?}", err);
|
warn!(context, "Invalid body parsed {:?}", err);
|
||||||
// Note that it's not always an error - might be no data
|
// Note that it's not always an error - might be no data
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (simplified_txt, is_forwarded) = if decoded_data.is_empty() {
|
let (simplified_txt, is_forwarded) = if decoded_data.is_empty() {
|
||||||
("".into(), false)
|
("".into(), false)
|
||||||
} else {
|
} else {
|
||||||
let is_html = mime_type == mime::TEXT_HTML;
|
let is_html = mime_type == mime::TEXT_HTML;
|
||||||
let out = if is_html {
|
let out = if is_html {
|
||||||
dehtml(&decoded_data)
|
dehtml(&decoded_data)
|
||||||
} else {
|
} else {
|
||||||
decoded_data.clone()
|
decoded_data.clone()
|
||||||
};
|
};
|
||||||
simplify(out, self.has_chat_version())
|
simplify(out, self.has_chat_version())
|
||||||
};
|
};
|
||||||
|
|
||||||
if !simplified_txt.is_empty() {
|
if !simplified_txt.is_empty() {
|
||||||
let mut part = Part::default();
|
let mut part = Part::default();
|
||||||
part.typ = Viewtype::Text;
|
part.typ = Viewtype::Text;
|
||||||
part.mimetype = Some(mime_type);
|
part.mimetype = Some(mime_type);
|
||||||
part.msg = simplified_txt;
|
part.msg = simplified_txt;
|
||||||
part.msg_raw = Some(decoded_data);
|
part.msg_raw = Some(decoded_data);
|
||||||
self.do_add_single_part(part);
|
self.do_add_single_part(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_forwarded {
|
if is_forwarded {
|
||||||
self.is_forwarded = true;
|
self.is_forwarded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add object? (we do not add all objects, eg. signatures etc. are ignored)
|
// add object? (we do not add all objects, eg. signatures etc. are ignored)
|
||||||
|
|||||||
Reference in New Issue
Block a user