mirror of
https://github.com/chatmail/core.git
synced 2026-04-23 00:16:34 +03:00
Merge pull request #297 from deltachat/remove_gotos_dc_mimefactory
Remove gotos from dc_mimefactory
This commit is contained in:
@@ -346,7 +346,7 @@ pub unsafe fn dc_mimefactory_load_mdn(
|
|||||||
// TODO should return bool /rtn
|
// TODO should return bool /rtn
|
||||||
pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc::c_int {
|
pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc::c_int {
|
||||||
let subject: *mut mailimf_subject;
|
let subject: *mut mailimf_subject;
|
||||||
let mut current_block: u64;
|
let mut ok_to_continue = true;
|
||||||
let imf_fields: *mut mailimf_fields;
|
let imf_fields: *mut mailimf_fields;
|
||||||
let mut message: *mut mailmime = 0 as *mut mailmime;
|
let mut message: *mut mailmime = 0 as *mut mailmime;
|
||||||
let mut message_text: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut message_text: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
@@ -847,7 +847,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
);
|
);
|
||||||
set_error(factory, error);
|
set_error(factory, error);
|
||||||
free(error as *mut libc::c_void);
|
free(error as *mut libc::c_void);
|
||||||
current_block = 11328123142868406523;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
let file_part: *mut mailmime =
|
let file_part: *mut mailmime =
|
||||||
build_body_file(msg, 0 as *const libc::c_char, 0 as *mut *mut libc::c_char);
|
build_body_file(msg, 0 as *const libc::c_char, 0 as *mut *mut libc::c_char);
|
||||||
@@ -855,20 +855,15 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
mailmime_smart_add_part(message, file_part);
|
mailmime_smart_add_part(message, file_part);
|
||||||
parts += 1
|
parts += 1
|
||||||
}
|
}
|
||||||
current_block = 13000670339742628194;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 13000670339742628194;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
if ok_to_continue {
|
||||||
11328123142868406523 => {}
|
|
||||||
_ => {
|
|
||||||
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,
|
||||||
);
|
);
|
||||||
current_block = 11328123142868406523;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
if !meta_part.is_null() {
|
if !meta_part.is_null() {
|
||||||
mailmime_smart_add_part(message, meta_part);
|
mailmime_smart_add_part(message, meta_part);
|
||||||
@@ -891,9 +886,7 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
);
|
);
|
||||||
let mime_fields = mailmime_fields_new_filename(
|
let mime_fields = mailmime_fields_new_filename(
|
||||||
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
||||||
dc_strdup(
|
dc_strdup(b"message.kml\x00" as *const u8 as *const libc::c_char),
|
||||||
b"message.kml\x00" as *const u8 as *const libc::c_char,
|
|
||||||
),
|
|
||||||
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
||||||
);
|
);
|
||||||
let kml_mime_part = mailmime_new_empty(content_type, mime_fields);
|
let kml_mime_part = mailmime_new_empty(content_type, mime_fields);
|
||||||
@@ -911,17 +904,13 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
&mut last_added_location_id,
|
&mut last_added_location_id,
|
||||||
);
|
);
|
||||||
if !kml_file.is_null() {
|
if !kml_file.is_null() {
|
||||||
let content_type: *mut mailmime_content =
|
let content_type: *mut mailmime_content = mailmime_content_new_with_str(
|
||||||
mailmime_content_new_with_str(
|
|
||||||
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
b"application/vnd.google-earth.kml+xml\x00" as *const u8
|
||||||
as *const libc::c_char,
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
let mime_fields: *mut mailmime_fields =
|
let mime_fields: *mut mailmime_fields = mailmime_fields_new_filename(
|
||||||
mailmime_fields_new_filename(
|
|
||||||
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
MAILMIME_DISPOSITION_TYPE_ATTACHMENT as libc::c_int,
|
||||||
dc_strdup(
|
dc_strdup(b"location.kml\x00" as *const u8 as *const libc::c_char),
|
||||||
b"location.kml\x00" as *const u8 as *const libc::c_char,
|
|
||||||
),
|
|
||||||
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
MAILMIME_MECHANISM_8BIT as libc::c_int,
|
||||||
);
|
);
|
||||||
let kml_mime_part: *mut mailmime =
|
let kml_mime_part: *mut mailmime =
|
||||||
@@ -934,8 +923,6 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_block = 9952640327414195044;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (*factory).loaded as libc::c_uint
|
} else if (*factory).loaded as libc::c_uint
|
||||||
@@ -988,20 +975,16 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
mailmime_set_body_text(mach_mime_part, message_text2, strlen(message_text2));
|
mailmime_set_body_text(mach_mime_part, message_text2, strlen(message_text2));
|
||||||
mailmime_add_part(multipart, mach_mime_part);
|
mailmime_add_part(multipart, mach_mime_part);
|
||||||
force_plaintext = 2;
|
force_plaintext = 2;
|
||||||
current_block = 9952640327414195044;
|
|
||||||
} else {
|
} else {
|
||||||
set_error(
|
set_error(
|
||||||
factory,
|
factory,
|
||||||
b"No message loaded.\x00" as *const u8 as *const libc::c_char,
|
b"No message loaded.\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
current_block = 11328123142868406523;
|
ok_to_continue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
match current_block {
|
if ok_to_continue {
|
||||||
11328123142868406523 => {}
|
if (*factory).loaded as libc::c_uint == DC_MF_MDN_LOADED as libc::c_int as libc::c_uint
|
||||||
_ => {
|
|
||||||
if (*factory).loaded as libc::c_uint
|
|
||||||
== DC_MF_MDN_LOADED as libc::c_int as libc::c_uint
|
|
||||||
{
|
{
|
||||||
let e = CString::new(
|
let e = CString::new(
|
||||||
(*factory)
|
(*factory)
|
||||||
@@ -1069,7 +1052,6 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
|||||||
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