mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +03:00
cargo fmt
This commit is contained in:
@@ -637,30 +637,30 @@ impl<'a> MimeParser<'a> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* check header directly as is_send_by_messenger is not yet set up */
|
/* check header directly as is_send_by_messenger is not yet set up */
|
||||||
let is_msgrmsg = self.lookup_optional_field("Chat-Version").is_some();
|
let is_msgrmsg = self.lookup_optional_field("Chat-Version").is_some();
|
||||||
|
|
||||||
let simplified_txt = if decoded_data.is_empty() {
|
let simplified_txt = if decoded_data.is_empty() {
|
||||||
"".into()
|
"".into()
|
||||||
} else {
|
} else {
|
||||||
let input = std::string::String::from_utf8_lossy(&decoded_data);
|
let input = std::string::String::from_utf8_lossy(&decoded_data);
|
||||||
let is_html = mime_type == 70;
|
let is_html = mime_type == 70;
|
||||||
|
|
||||||
simplifier.unwrap().simplify(&input, is_html, is_msgrmsg)
|
simplifier.unwrap().simplify(&input, is_html, is_msgrmsg)
|
||||||
};
|
};
|
||||||
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 = mime_type;
|
part.mimetype = mime_type;
|
||||||
part.msg = Some(simplified_txt);
|
part.msg = Some(simplified_txt);
|
||||||
part.msg_raw =
|
part.msg_raw =
|
||||||
Some(std::string::String::from_utf8_lossy(&decoded_data).to_string());
|
Some(std::string::String::from_utf8_lossy(&decoded_data).to_string());
|
||||||
self.do_add_single_part(part);
|
self.do_add_single_part(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
if simplifier.unwrap().is_forwarded {
|
if simplifier.unwrap().is_forwarded {
|
||||||
self.is_forwarded = true;
|
self.is_forwarded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DC_MIMETYPE_IMAGE
|
DC_MIMETYPE_IMAGE
|
||||||
| DC_MIMETYPE_AUDIO
|
| DC_MIMETYPE_AUDIO
|
||||||
@@ -737,29 +737,27 @@ impl<'a> MimeParser<'a> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if desired_filename.starts_with("location")
|
if desired_filename.starts_with("location") && desired_filename.ends_with(".kml") {
|
||||||
&& desired_filename.ends_with(".kml")
|
if !decoded_data.is_empty() {
|
||||||
{
|
let d = std::string::String::from_utf8_lossy(&decoded_data);
|
||||||
if !decoded_data.is_empty() {
|
self.location_kml = location::Kml::parse(self.context, &d).ok();
|
||||||
let d = std::string::String::from_utf8_lossy(&decoded_data);
|
|
||||||
self.location_kml = location::Kml::parse(self.context, &d).ok();
|
|
||||||
}
|
|
||||||
} else if desired_filename.starts_with("message")
|
|
||||||
&& desired_filename.ends_with(".kml")
|
|
||||||
{
|
|
||||||
if !decoded_data.is_empty() {
|
|
||||||
let d = std::string::String::from_utf8_lossy(&decoded_data);
|
|
||||||
self.message_kml = location::Kml::parse(self.context, &d).ok();
|
|
||||||
}
|
|
||||||
} else if !decoded_data.is_empty() {
|
|
||||||
self.do_add_single_file_part(
|
|
||||||
msg_type,
|
|
||||||
mime_type,
|
|
||||||
raw_mime.as_ref(),
|
|
||||||
&decoded_data,
|
|
||||||
&desired_filename,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
} else if desired_filename.starts_with("message")
|
||||||
|
&& desired_filename.ends_with(".kml")
|
||||||
|
{
|
||||||
|
if !decoded_data.is_empty() {
|
||||||
|
let d = std::string::String::from_utf8_lossy(&decoded_data);
|
||||||
|
self.message_kml = location::Kml::parse(self.context, &d).ok();
|
||||||
|
}
|
||||||
|
} else if !decoded_data.is_empty() {
|
||||||
|
self.do_add_single_file_part(
|
||||||
|
msg_type,
|
||||||
|
mime_type,
|
||||||
|
raw_mime.as_ref(),
|
||||||
|
&decoded_data,
|
||||||
|
&desired_filename,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user