mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
run rustfmt
This commit is contained in:
@@ -901,84 +901,71 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if parts == 0 {
|
if parts == 0 {
|
||||||
set_error(
|
set_error(
|
||||||
factory,
|
factory,
|
||||||
b"Empty message.\x00" as *const u8 as *const libc::c_char,
|
b"Empty message.\x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
return cleanup(e2ee_helper);
|
||||||
|
} else {
|
||||||
|
if !meta_part.is_null() {
|
||||||
|
mailmime_smart_add_part(message, meta_part);
|
||||||
|
}
|
||||||
|
if 0 != dc_param_exists((*msg).param, DC_PARAM_SET_LATITUDE as libc::c_int) {
|
||||||
|
let latitude =
|
||||||
|
dc_param_get_float((*msg).param, DC_PARAM_SET_LATITUDE as libc::c_int, 0.0);
|
||||||
|
let longitude = dc_param_get_float(
|
||||||
|
(*msg).param,
|
||||||
|
DC_PARAM_SET_LONGITUDE as libc::c_int,
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
|
let kml_file = dc_get_message_kml((*msg).timestamp_sort, latitude, longitude);
|
||||||
|
if !kml_file.is_null() {
|
||||||
|
let content_type = mailmime_content_new_with_str(
|
||||||
|
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
||||||
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
return cleanup(e2ee_helper);
|
let mime_fields = mailmime_fields_new_filename(
|
||||||
} else {
|
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
||||||
if !meta_part.is_null() {
|
dc_strdup(b"message.kml\x00" as *const u8 as *const libc::c_char),
|
||||||
mailmime_smart_add_part(message, meta_part);
|
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
||||||
}
|
);
|
||||||
if 0 != dc_param_exists((*msg).param, DC_PARAM_SET_LATITUDE as libc::c_int)
|
let kml_mime_part = mailmime_new_empty(content_type, mime_fields);
|
||||||
|
mailmime_set_body_text(kml_mime_part, kml_file, strlen(kml_file));
|
||||||
|
|
||||||
|
mailmime_smart_add_part(message, kml_mime_part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if dc_is_sending_locations_to_chat((*msg).context, (*msg).chat_id) {
|
||||||
|
let mut last_added_location_id: uint32_t = 0 as uint32_t;
|
||||||
|
let kml_file: *mut libc::c_char = dc_get_location_kml(
|
||||||
|
(*msg).context,
|
||||||
|
(*msg).chat_id,
|
||||||
|
&mut last_added_location_id,
|
||||||
|
);
|
||||||
|
if !kml_file.is_null() {
|
||||||
|
let content_type: *mut mailmime_content = mailmime_content_new_with_str(
|
||||||
|
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
||||||
|
as *const libc::c_char,
|
||||||
|
);
|
||||||
|
let mime_fields: *mut mailmime_fields = mailmime_fields_new_filename(
|
||||||
|
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
||||||
|
dc_strdup(b"location.kml\x00" as *const u8 as *const libc::c_char),
|
||||||
|
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
||||||
|
);
|
||||||
|
let kml_mime_part: *mut mailmime =
|
||||||
|
mailmime_new_empty(content_type, mime_fields);
|
||||||
|
mailmime_set_body_text(kml_mime_part, kml_file, strlen(kml_file));
|
||||||
|
mailmime_smart_add_part(message, kml_mime_part);
|
||||||
|
if 0 == dc_param_exists((*msg).param, DC_PARAM_SET_LATITUDE as libc::c_int)
|
||||||
{
|
{
|
||||||
let latitude = dc_param_get_float(
|
// otherwise, the independent location is already filed
|
||||||
(*msg).param,
|
(*factory).out_last_added_location_id = last_added_location_id;
|
||||||
DC_PARAM_SET_LATITUDE as libc::c_int,
|
|
||||||
0.0,
|
|
||||||
);
|
|
||||||
let longitude = dc_param_get_float(
|
|
||||||
(*msg).param,
|
|
||||||
DC_PARAM_SET_LONGITUDE as libc::c_int,
|
|
||||||
0.0,
|
|
||||||
);
|
|
||||||
let kml_file =
|
|
||||||
dc_get_message_kml((*msg).timestamp_sort, latitude, longitude);
|
|
||||||
if !kml_file.is_null() {
|
|
||||||
let content_type = mailmime_content_new_with_str(
|
|
||||||
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
|
||||||
as *const libc::c_char,
|
|
||||||
);
|
|
||||||
let mime_fields = mailmime_fields_new_filename(
|
|
||||||
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
|
||||||
dc_strdup(
|
|
||||||
b"message.kml\x00" as *const u8 as *const libc::c_char,
|
|
||||||
),
|
|
||||||
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
|
||||||
);
|
|
||||||
let kml_mime_part = mailmime_new_empty(content_type, mime_fields);
|
|
||||||
mailmime_set_body_text(kml_mime_part, kml_file, strlen(kml_file));
|
|
||||||
|
|
||||||
mailmime_smart_add_part(message, kml_mime_part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if dc_is_sending_locations_to_chat((*msg).context, (*msg).chat_id) {
|
|
||||||
let mut last_added_location_id: uint32_t = 0 as uint32_t;
|
|
||||||
let kml_file: *mut libc::c_char = dc_get_location_kml(
|
|
||||||
(*msg).context,
|
|
||||||
(*msg).chat_id,
|
|
||||||
&mut last_added_location_id,
|
|
||||||
);
|
|
||||||
if !kml_file.is_null() {
|
|
||||||
let content_type: *mut mailmime_content =
|
|
||||||
mailmime_content_new_with_str(
|
|
||||||
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
|
||||||
as *const libc::c_char,
|
|
||||||
);
|
|
||||||
let mime_fields: *mut mailmime_fields =
|
|
||||||
mailmime_fields_new_filename(
|
|
||||||
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
|
||||||
dc_strdup(
|
|
||||||
b"location.kml\x00" as *const u8 as *const libc::c_char,
|
|
||||||
),
|
|
||||||
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
|
||||||
);
|
|
||||||
let kml_mime_part: *mut mailmime =
|
|
||||||
mailmime_new_empty(content_type, mime_fields);
|
|
||||||
mailmime_set_body_text(kml_mime_part, kml_file, strlen(kml_file));
|
|
||||||
mailmime_smart_add_part(message, kml_mime_part);
|
|
||||||
if 0 == dc_param_exists(
|
|
||||||
(*msg).param,
|
|
||||||
DC_PARAM_SET_LATITUDE as libc::c_int,
|
|
||||||
) {
|
|
||||||
// otherwise, the independent location is already filed
|
|
||||||
(*factory).out_last_added_location_id = last_added_location_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (*factory).loaded as libc::c_uint
|
} else if (*factory).loaded as libc::c_uint
|
||||||
== DC_MF_MDN_LOADED as libc::c_int as libc::c_uint
|
== DC_MF_MDN_LOADED as libc::c_int as libc::c_uint
|
||||||
{
|
{
|
||||||
@@ -1030,67 +1017,64 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
);
|
);
|
||||||
return cleanup(e2ee_helper);
|
return cleanup(e2ee_helper);
|
||||||
}
|
}
|
||||||
if (*factory).loaded as libc::c_uint
|
if (*factory).loaded as libc::c_uint == DC_MF_MDN_LOADED as libc::c_int as libc::c_uint {
|
||||||
== DC_MF_MDN_LOADED as libc::c_int as libc::c_uint
|
let e: *mut libc::c_char = dc_stock_str((*factory).context, 31);
|
||||||
{
|
subject_str = dc_mprintf(b"Chat: %s\x00" as *const u8 as *const libc::c_char, e);
|
||||||
let e: *mut libc::c_char = dc_stock_str((*factory).context, 31);
|
free(e as *mut libc::c_void);
|
||||||
subject_str =
|
} else {
|
||||||
dc_mprintf(b"Chat: %s\x00" as *const u8 as *const libc::c_char, e);
|
subject_str = get_subject((*factory).chat, (*factory).msg, afwd_email)
|
||||||
free(e as *mut libc::c_void);
|
}
|
||||||
} else {
|
subject = mailimf_subject_new(dc_encode_header_words(subject_str));
|
||||||
subject_str = get_subject((*factory).chat, (*factory).msg, afwd_email)
|
mailimf_fields_add(
|
||||||
}
|
imf_fields,
|
||||||
subject = mailimf_subject_new(dc_encode_header_words(subject_str));
|
mailimf_field_new(
|
||||||
mailimf_fields_add(
|
MAILIMF_FIELD_SUBJECT as libc::c_int,
|
||||||
imf_fields,
|
0 as *mut mailimf_return,
|
||||||
mailimf_field_new(
|
0 as *mut mailimf_orig_date,
|
||||||
MAILIMF_FIELD_SUBJECT as libc::c_int,
|
0 as *mut mailimf_from,
|
||||||
0 as *mut mailimf_return,
|
0 as *mut mailimf_sender,
|
||||||
0 as *mut mailimf_orig_date,
|
0 as *mut mailimf_to,
|
||||||
0 as *mut mailimf_from,
|
0 as *mut mailimf_cc,
|
||||||
0 as *mut mailimf_sender,
|
0 as *mut mailimf_bcc,
|
||||||
0 as *mut mailimf_to,
|
0 as *mut mailimf_message_id,
|
||||||
0 as *mut mailimf_cc,
|
0 as *mut mailimf_orig_date,
|
||||||
0 as *mut mailimf_bcc,
|
0 as *mut mailimf_from,
|
||||||
0 as *mut mailimf_message_id,
|
0 as *mut mailimf_sender,
|
||||||
0 as *mut mailimf_orig_date,
|
0 as *mut mailimf_reply_to,
|
||||||
0 as *mut mailimf_from,
|
0 as *mut mailimf_to,
|
||||||
0 as *mut mailimf_sender,
|
0 as *mut mailimf_cc,
|
||||||
0 as *mut mailimf_reply_to,
|
0 as *mut mailimf_bcc,
|
||||||
0 as *mut mailimf_to,
|
0 as *mut mailimf_message_id,
|
||||||
0 as *mut mailimf_cc,
|
0 as *mut mailimf_in_reply_to,
|
||||||
0 as *mut mailimf_bcc,
|
0 as *mut mailimf_references,
|
||||||
0 as *mut mailimf_message_id,
|
subject,
|
||||||
0 as *mut mailimf_in_reply_to,
|
0 as *mut mailimf_comments,
|
||||||
0 as *mut mailimf_references,
|
0 as *mut mailimf_keywords,
|
||||||
subject,
|
0 as *mut mailimf_optional_field,
|
||||||
0 as *mut mailimf_comments,
|
),
|
||||||
0 as *mut mailimf_keywords,
|
);
|
||||||
0 as *mut mailimf_optional_field,
|
if force_plaintext != 2 {
|
||||||
),
|
dc_e2ee_encrypt(
|
||||||
);
|
(*factory).context,
|
||||||
if force_plaintext != 2 {
|
(*factory).recipients_addr,
|
||||||
dc_e2ee_encrypt(
|
force_plaintext,
|
||||||
(*factory).context,
|
e2ee_guaranteed,
|
||||||
(*factory).recipients_addr,
|
min_verified,
|
||||||
force_plaintext,
|
do_gossip,
|
||||||
e2ee_guaranteed,
|
message,
|
||||||
min_verified,
|
&mut e2ee_helper,
|
||||||
do_gossip,
|
);
|
||||||
message,
|
}
|
||||||
&mut e2ee_helper,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if 0 != e2ee_helper.encryption_successfull {
|
if 0 != e2ee_helper.encryption_successfull {
|
||||||
(*factory).out_encrypted = 1;
|
(*factory).out_encrypted = 1;
|
||||||
if 0 != do_gossip {
|
if 0 != do_gossip {
|
||||||
(*factory).out_gossiped = 1
|
(*factory).out_gossiped = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*factory).out = mmap_string_new(b"\x00" as *const u8 as *const libc::c_char);
|
(*factory).out = mmap_string_new(b"\x00" as *const u8 as *const libc::c_char);
|
||||||
mailmime_write_mem((*factory).out, &mut col, message);
|
mailmime_write_mem((*factory).out, &mut col, message);
|
||||||
success = 1
|
success = 1
|
||||||
}
|
}
|
||||||
if !message.is_null() {
|
if !message.is_null() {
|
||||||
mailmime_free(message);
|
mailmime_free(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user