mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
remove gotos from dc_receive_imf method
This commit is contained in:
@@ -35,7 +35,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
server_uid: uint32_t,
|
server_uid: uint32_t,
|
||||||
flags: uint32_t,
|
flags: uint32_t,
|
||||||
) {
|
) {
|
||||||
let mut current_block: u64;
|
let mut ok_to_continue = true;
|
||||||
/* the function returns the number of created messages in the database */
|
/* the function returns the number of created messages in the database */
|
||||||
let mut incoming: libc::c_int = 1;
|
let mut incoming: libc::c_int = 1;
|
||||||
let mut incoming_origin: libc::c_int = 0;
|
let mut incoming_origin: libc::c_int = 0;
|
||||||
@@ -169,16 +169,11 @@ pub unsafe fn dc_receive_imf(
|
|||||||
rfc724_mid = dc_create_incoming_rfc724_mid(sent_timestamp, from_id, to_ids);
|
rfc724_mid = dc_create_incoming_rfc724_mid(sent_timestamp, from_id, to_ids);
|
||||||
if rfc724_mid.is_null() {
|
if rfc724_mid.is_null() {
|
||||||
info!(context, 0, "Cannot create Message-ID.",);
|
info!(context, 0, "Cannot create Message-ID.",);
|
||||||
current_block = 16282941964262048061;
|
ok_to_continue = false;
|
||||||
} else {
|
|
||||||
current_block = 777662472977924419;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 777662472977924419;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
// ok_to_continue = false = 16282941964262048061
|
||||||
16282941964262048061 => {}
|
if ok_to_continue {
|
||||||
_ => {
|
|
||||||
/* check, if the mail is already in our database - if so, just update the folder/uid (if the mail was moved around) and finish.
|
/* check, if the mail is already in our database - if so, just update the folder/uid (if the mail was moved around) and finish.
|
||||||
(we may get a mail twice eg. if it is moved between folders. make sure, this check is done eg. before securejoin-processing) */
|
(we may get a mail twice eg. if it is moved between folders. make sure, this check is done eg. before securejoin-processing) */
|
||||||
let mut old_server_folder: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut old_server_folder: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
@@ -201,7 +196,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
free(old_server_folder as *mut libc::c_void);
|
free(old_server_folder as *mut libc::c_void);
|
||||||
info!(context, 0, "Message already in DB.");
|
info!(context, 0, "Message already in DB.");
|
||||||
current_block = 16282941964262048061;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
msgrmsg = mime_parser.is_send_by_messenger;
|
msgrmsg = mime_parser.is_send_by_messenger;
|
||||||
if msgrmsg == 0
|
if msgrmsg == 0
|
||||||
@@ -447,7 +442,6 @@ pub unsafe fn dc_receive_imf(
|
|||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
loop {
|
loop {
|
||||||
if !(i < icnt) {
|
if !(i < icnt) {
|
||||||
current_block = 2756754640271984560;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let part = &mut mime_parser.parts[i];
|
let part = &mut mime_parser.parts[i];
|
||||||
@@ -525,7 +519,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
if res.is_err() {
|
if res.is_err() {
|
||||||
info!(context, 0, "Cannot write DB.",);
|
info!(context, 0, "Cannot write DB.",);
|
||||||
/* i/o error - there is nothing more we can do - in other cases, we try to write at least an empty record */
|
/* i/o error - there is nothing more we can do - in other cases, we try to write at least an empty record */
|
||||||
current_block = 16282941964262048061;
|
ok_to_continue = false;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
free(txt_raw as *mut libc::c_void);
|
free(txt_raw as *mut libc::c_void);
|
||||||
@@ -545,9 +539,8 @@ pub unsafe fn dc_receive_imf(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
).unwrap(); // TODO: better error handling
|
).unwrap(); // TODO: better error handling
|
||||||
match current_block {
|
// ok_to_continue = false = 16282941964262048061
|
||||||
16282941964262048061 => {}
|
if ok_to_continue {
|
||||||
_ => {
|
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
0,
|
0,
|
||||||
@@ -571,21 +564,16 @@ pub unsafe fn dc_receive_imf(
|
|||||||
server_folder.as_ref(),
|
server_folder.as_ref(),
|
||||||
insert_msg_id,
|
insert_msg_id,
|
||||||
);
|
);
|
||||||
current_block = 18330534242458572360;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if sent_timestamp > time() {
|
if sent_timestamp > time() {
|
||||||
sent_timestamp = time()
|
sent_timestamp = time()
|
||||||
}
|
}
|
||||||
current_block = 18330534242458572360;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
// ok_to_continue = false = 16282941964262048061
|
||||||
16282941964262048061 => {}
|
if ok_to_continue {
|
||||||
_ => {
|
|
||||||
if !mime_parser.reports.is_empty() {
|
if !mime_parser.reports.is_empty() {
|
||||||
let mdns_enabled = context
|
let mdns_enabled = context
|
||||||
.sql
|
.sql
|
||||||
@@ -818,7 +806,6 @@ pub unsafe fn dc_receive_imf(
|
|||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,7 +833,6 @@ pub unsafe fn dc_receive_imf(
|
|||||||
|
|
||||||
free(txt_raw as *mut libc::c_void);
|
free(txt_raw as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ******************************************************************************
|
/* ******************************************************************************
|
||||||
* Misc. Tools
|
* Misc. Tools
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user