less dead code, and update test

This commit is contained in:
dignifiedquire
2019-11-30 17:04:30 +01:00
parent 734bbff04d
commit 48dd3b8506
2 changed files with 23 additions and 55 deletions

View File

@@ -96,33 +96,6 @@ pub(crate) fn dc_str_to_color(s: impl AsRef<str>) -> u32 {
COLORS[color_index] COLORS[color_index]
} }
/* date/time tools */
/* the result is UTC or DC_INVALID_TIMESTAMP */
// pub(crate) fn dc_timestamp_from_date(date_time: *mut mailimf_date_time) -> i64 {
// assert!(!date_time.is_null());
// let dt = { *date_time };
// let sec = dt.dt_sec;
// let min = dt.dt_min;
// let hour = dt.dt_hour;
// let day = dt.dt_day;
// let month = dt.dt_month;
// let year = dt.dt_year;
// let ts = chrono::NaiveDateTime::new(
// chrono::NaiveDate::from_ymd(year, month as u32, day as u32),
// chrono::NaiveTime::from_hms(hour as u32, min as u32, sec as u32),
// );
// let (zone_hour, zone_min) = if dt.dt_zone >= 0 {
// (dt.dt_zone / 100, dt.dt_zone % 100)
// } else {
// (-(-dt.dt_zone / 100), -(-dt.dt_zone % 100))
// };
// ts.timestamp() - (zone_hour * 3600 + zone_min * 60) as i64
// }
/* ****************************************************************************** /* ******************************************************************************
* date/time tools * date/time tools
******************************************************************************/ ******************************************************************************/

View File

@@ -377,9 +377,10 @@ mod tests {
} }
} }
// FIXME: https://github.com/staktrace/mailparse/issues/49
// #[test] // #[test]
// fn test_mailmime_parse() { // fn test_mailmime_parse() {
// let plain = b"Chat-Disposition-Notification-To: holger@deltachat.de // let plain = b"Chat-Disposition-Notification-To: hello@world.de
// Chat-Group-ID: CovhGgau8M- // Chat-Group-ID: CovhGgau8M-
// Chat-Group-Name: Delta Chat Dev // Chat-Group-Name: Delta Chat Dev
// Subject: =?utf-8?Q?Chat=3A?= Delta Chat =?utf-8?Q?Dev=3A?= sidenote for // Subject: =?utf-8?Q?Chat=3A?= Delta Chat =?utf-8?Q?Dev=3A?= sidenote for
@@ -387,35 +388,29 @@ mod tests {
// Content-Type: text/plain; charset=\"utf-8\"; protected-headers=\"v1\" // Content-Type: text/plain; charset=\"utf-8\"; protected-headers=\"v1\"
// Content-Transfer-Encoding: quoted-printable // Content-Transfer-Encoding: quoted-printable
// sidenote for all: rust core master is broken currently ... so dont recomm= // sidenote for all: things are trick atm recomm=
// end to try to run with desktop or ios unless you are ready to hunt bugs // end not to try to run with desktop or ios unless you are ready to hunt bugs
// -- =20 // -- =20
// Sent with my Delta Chat Messenger: https://delta.chat"; // Sent with my Delta Chat Messenger: https://delta.chat";
// let plain_bytes = plain.len(); // let mail = mailparse::parse_mail(plain).expect("failed to parse valid message");
// let plain_buf = plain.as_ptr() as *const libc::c_char;
// let mut index = 0; // println!(
// let mut decrypted_mime = std::ptr::null_mut(); // "{:?}",
// mail.headers
// .iter()
// .map(|h| (h.get_key(), h.get_value()))
// .collect::<Vec<_>>()
// );
// assert_eq!(mail.headers.len(), 6);
// assert_eq!(
// mail.get_body().unwrap(),
// " sidenote for all: things are trick atm recomm=
// end not to try to run with desktop or ios unless you are ready to hunt bugs
// let res = { // -- =20
// mailmime_parse( // Sent with my Delta Chat Messenger: https://delta.chat"
// plain_buf as *const _, // );
// plain_bytes,
// &mut index,
// &mut decrypted_mime,
// )
// };
// {
// let msg1 = (*decrypted_mime).mm_data.mm_message.mm_msg_mime;
// let data = mailmime_transfer_decode(msg1).unwrap();
// println!("{:?}", String::from_utf8_lossy(&data));
// }
// assert_eq!(res, 0);
// assert!(!decrypted_mime.is_null());
// { free(decrypted_mime as *mut _) };
// } // }
mod load_or_generate_self_public_key { mod load_or_generate_self_public_key {