mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
some streamlinings, after advise by @dignifedquire
This commit is contained in:
@@ -176,10 +176,7 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
&mut (*mimeparser).e2ee_helper,
|
&mut (*mimeparser).e2ee_helper,
|
||||||
);
|
);
|
||||||
dc_mimeparser_parse_mime_recursive(mimeparser, (*mimeparser).mimeroot);
|
dc_mimeparser_parse_mime_recursive(mimeparser, (*mimeparser).mimeroot);
|
||||||
let field: *mut mailimf_field = dc_mimeparser_lookup_field(
|
let field: *mut mailimf_field = dc_mimeparser_lookup_field_r(mimeparser, "Subject");
|
||||||
mimeparser,
|
|
||||||
b"Subject\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_SUBJECT as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_SUBJECT as libc::c_int {
|
||||||
(*mimeparser).subject =
|
(*mimeparser).subject =
|
||||||
dc_decode_header_words((*(*field).fld_data.fld_subject).sbj_value)
|
dc_decode_header_words((*(*field).fld_data.fld_subject).sbj_value)
|
||||||
@@ -192,12 +189,7 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
{
|
{
|
||||||
(*mimeparser).is_send_by_messenger = 1i32
|
(*mimeparser).is_send_by_messenger = 1i32
|
||||||
}
|
}
|
||||||
if !dc_mimeparser_lookup_field(
|
if !dc_mimeparser_lookup_field_r(mimeparser, "Autocrypt-Setup-Message").is_null() {
|
||||||
mimeparser,
|
|
||||||
b"Autocrypt-Setup-Message\x00" as *const u8 as *const libc::c_char,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
{
|
|
||||||
let mut i: libc::c_int;
|
let mut i: libc::c_int;
|
||||||
let mut has_setup_file: libc::c_int = 0i32;
|
let mut has_setup_file: libc::c_int = 0i32;
|
||||||
i = 0i32;
|
i = 0i32;
|
||||||
@@ -238,11 +230,7 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !dc_mimeparser_lookup_field(
|
if !dc_mimeparser_lookup_field_r(mimeparser, "Chat-Group-Image").is_null()
|
||||||
mimeparser,
|
|
||||||
b"Chat-Group-Image\x00" as *const u8 as *const libc::c_char,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
&& carray_count((*mimeparser).parts) >= 1i32 as libc::c_uint
|
&& carray_count((*mimeparser).parts) >= 1i32 as libc::c_uint
|
||||||
{
|
{
|
||||||
let textpart: *mut dc_mimepart_t =
|
let textpart: *mut dc_mimepart_t =
|
||||||
@@ -384,10 +372,8 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
{
|
{
|
||||||
let dn_to_addr: *mut libc::c_char = mailimf_find_first_addr(mb_list);
|
let dn_to_addr: *mut libc::c_char = mailimf_find_first_addr(mb_list);
|
||||||
if !dn_to_addr.is_null() {
|
if !dn_to_addr.is_null() {
|
||||||
let from_field: *mut mailimf_field = dc_mimeparser_lookup_field(
|
let from_field: *mut mailimf_field =
|
||||||
mimeparser,
|
dc_mimeparser_lookup_field_r(mimeparser, "From");
|
||||||
b"From\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !from_field.is_null()
|
if !from_field.is_null()
|
||||||
&& (*from_field).fld_type == MAILIMF_FIELD_FROM as libc::c_int
|
&& (*from_field).fld_type == MAILIMF_FIELD_FROM as libc::c_int
|
||||||
&& !(*from_field).fld_data.fld_from.is_null()
|
&& !(*from_field).fld_data.fld_from.is_null()
|
||||||
@@ -499,6 +485,17 @@ pub fn dc_mimeparser_lookup_field(
|
|||||||
.unwrap_or_else(|| std::ptr::null_mut())
|
.unwrap_or_else(|| std::ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn dc_mimeparser_lookup_field_r(
|
||||||
|
mimeparser: &dc_mimeparser_t,
|
||||||
|
field_name: &str,
|
||||||
|
) -> *mut mailimf_field {
|
||||||
|
mimeparser
|
||||||
|
.header
|
||||||
|
.get(field_name)
|
||||||
|
.map(|v| *v)
|
||||||
|
.unwrap_or_else(|| std::ptr::null_mut())
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_mimeparser_lookup_optional_field(
|
pub unsafe fn dc_mimeparser_lookup_optional_field(
|
||||||
mimeparser: &dc_mimeparser_t,
|
mimeparser: &dc_mimeparser_t,
|
||||||
field_name: *const libc::c_char,
|
field_name: *const libc::c_char,
|
||||||
@@ -1627,12 +1624,7 @@ pub unsafe fn mailmime_transfer_decode(
|
|||||||
|
|
||||||
// TODO should return bool /rtn
|
// TODO should return bool /rtn
|
||||||
pub unsafe fn dc_mimeparser_is_mailinglist_message(mimeparser: &dc_mimeparser_t) -> libc::c_int {
|
pub unsafe fn dc_mimeparser_is_mailinglist_message(mimeparser: &dc_mimeparser_t) -> libc::c_int {
|
||||||
if !dc_mimeparser_lookup_field(
|
if !dc_mimeparser_lookup_field_r(&mimeparser, "List-Id").is_null() {
|
||||||
&mimeparser,
|
|
||||||
b"List-Id\x00" as *const u8 as *const libc::c_char,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
{
|
|
||||||
return 1i32;
|
return 1i32;
|
||||||
}
|
}
|
||||||
let precedence: *mut mailimf_optional_field = dc_mimeparser_lookup_optional_field(
|
let precedence: *mut mailimf_optional_field = dc_mimeparser_lookup_optional_field(
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ pub unsafe fn dc_receive_imf(
|
|||||||
/* 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 = 1i32;
|
let mut incoming: libc::c_int = 1i32;
|
||||||
let mut incoming_origin: libc::c_int = 0i32;
|
let mut incoming_origin: libc::c_int = 0i32;
|
||||||
let to_ids: *mut dc_array_t;
|
|
||||||
let mut to_self: libc::c_int = 0i32;
|
let mut to_self: libc::c_int = 0i32;
|
||||||
let mut from_id: uint32_t = 0i32 as uint32_t;
|
let mut from_id: uint32_t = 0i32 as uint32_t;
|
||||||
let mut from_id_blocked: libc::c_int = 0i32;
|
let mut from_id_blocked: libc::c_int = 0i32;
|
||||||
@@ -60,56 +59,43 @@ pub unsafe fn dc_receive_imf(
|
|||||||
let mut sort_timestamp = 0;
|
let mut sort_timestamp = 0;
|
||||||
let mut sent_timestamp = 0;
|
let mut sent_timestamp = 0;
|
||||||
let mut rcvd_timestamp = 0;
|
let mut rcvd_timestamp = 0;
|
||||||
let mut mime_parser = dc_mimeparser_new(context);
|
|
||||||
let mut field: *const mailimf_field;
|
let mut field: *const mailimf_field;
|
||||||
let mut mime_in_reply_to: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut mime_in_reply_to: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let mut mime_references: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut mime_references: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
let created_db_entries: *mut carray = carray_new(16i32 as libc::c_uint);
|
let created_db_entries: *mut carray = carray_new(16);
|
||||||
let mut create_event_to_send = Some(Event::MSGS_CHANGED);
|
let mut create_event_to_send = Some(Event::MSGS_CHANGED);
|
||||||
let rr_event_to_send: *mut carray = carray_new(16i32 as libc::c_uint);
|
let rr_event_to_send: *mut carray = carray_new(16);
|
||||||
let mut txt_raw: *mut libc::c_char = 0 as *mut libc::c_char;
|
let mut txt_raw: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||||
dc_log_info(
|
let to_ids: *mut dc_array_t = dc_array_new(16);
|
||||||
|
|
||||||
|
// XXX in theory the three carray's could be NULL pointer
|
||||||
|
// but we want to get rid of carray (and dc_array) anyway in favor of Rust Vectors
|
||||||
|
assert!(!created_db_entries.is_null() && !rr_event_to_send.is_null() && !to_ids.is_null());
|
||||||
|
info!(
|
||||||
context,
|
context,
|
||||||
0i32,
|
0,
|
||||||
b"Receiving message %s/%lu...\x00" as *const u8 as *const libc::c_char,
|
"Receiving message {}/{}...",
|
||||||
if !server_folder.is_null() {
|
if !server_folder.is_null() {
|
||||||
server_folder
|
as_str(server_folder)
|
||||||
} else {
|
} else {
|
||||||
b"?\x00" as *const u8 as *const libc::c_char
|
"?"
|
||||||
},
|
},
|
||||||
server_uid,
|
server_uid,
|
||||||
);
|
);
|
||||||
to_ids = dc_array_new(16i32 as size_t);
|
let mut mime_parser = dc_mimeparser_new(context);
|
||||||
if to_ids.is_null() || created_db_entries.is_null() || rr_event_to_send.is_null() {
|
|
||||||
dc_log_info(
|
|
||||||
context,
|
|
||||||
0i32,
|
|
||||||
b"Bad param.\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
dc_mimeparser_parse(&mut mime_parser, imf_raw_not_terminated, imf_raw_bytes);
|
dc_mimeparser_parse(&mut mime_parser, imf_raw_not_terminated, imf_raw_bytes);
|
||||||
if mime_parser.header.is_empty() {
|
if mime_parser.header.is_empty() {
|
||||||
dc_log_info(
|
info!(context, 0, "No header.",);
|
||||||
context,
|
|
||||||
0i32,
|
|
||||||
b"No header.\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
/* Error - even adding an empty record won't help as we do not know the message ID */
|
/* Error - even adding an empty record won't help as we do not know the message ID */
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mut mime_parser, "Date");
|
||||||
&mut mime_parser,
|
|
||||||
b"Date\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_ORIG_DATE as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_ORIG_DATE as libc::c_int {
|
||||||
let orig_date: *mut mailimf_orig_date = (*field).fld_data.fld_orig_date;
|
let orig_date: *mut mailimf_orig_date = (*field).fld_data.fld_orig_date;
|
||||||
if !orig_date.is_null() {
|
if !orig_date.is_null() {
|
||||||
sent_timestamp = dc_timestamp_from_date((*orig_date).dt_date_time)
|
sent_timestamp = dc_timestamp_from_date((*orig_date).dt_date_time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "From");
|
||||||
&mime_parser,
|
|
||||||
b"From\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_FROM as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_FROM as libc::c_int {
|
||||||
let fld_from: *mut mailimf_from = (*field).fld_data.fld_from;
|
let fld_from: *mut mailimf_from = (*field).fld_data.fld_from;
|
||||||
if !fld_from.is_null() {
|
if !fld_from.is_null() {
|
||||||
@@ -129,16 +115,12 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
} else if dc_array_get_cnt(from_list) >= 1 {
|
} else if dc_array_get_cnt(from_list) >= 1 {
|
||||||
from_id = dc_array_get_id(from_list, 0i32 as size_t);
|
from_id = dc_array_get_id(from_list, 0i32 as size_t);
|
||||||
incoming_origin =
|
incoming_origin = dc_get_contact_origin(context, from_id, &mut from_id_blocked)
|
||||||
dc_get_contact_origin(context, from_id, &mut from_id_blocked)
|
|
||||||
}
|
}
|
||||||
dc_array_unref(from_list);
|
dc_array_unref(from_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "To");
|
||||||
&mime_parser,
|
|
||||||
b"To\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_TO as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_TO as libc::c_int {
|
||||||
let fld_to: *mut mailimf_to = (*field).fld_data.fld_to;
|
let fld_to: *mut mailimf_to = (*field).fld_data.fld_to;
|
||||||
if !fld_to.is_null() {
|
if !fld_to.is_null() {
|
||||||
@@ -158,10 +140,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !dc_mimeparser_get_last_nonmeta(&mime_parser).is_null() {
|
if !dc_mimeparser_get_last_nonmeta(&mime_parser).is_null() {
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "Cc");
|
||||||
&mime_parser,
|
|
||||||
b"Cc\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_CC as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_CC as libc::c_int {
|
||||||
let fld_cc: *mut mailimf_cc = (*field).fld_data.fld_cc;
|
let fld_cc: *mut mailimf_cc = (*field).fld_data.fld_cc;
|
||||||
if !fld_cc.is_null() {
|
if !fld_cc.is_null() {
|
||||||
@@ -180,12 +159,8 @@ pub unsafe fn dc_receive_imf(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "Message-ID");
|
||||||
&mime_parser,
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_MESSAGE_ID as libc::c_int {
|
||||||
b"Message-ID\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_MESSAGE_ID as libc::c_int
|
|
||||||
{
|
|
||||||
let fld_message_id: *mut mailimf_message_id = (*field).fld_data.fld_message_id;
|
let fld_message_id: *mut mailimf_message_id = (*field).fld_data.fld_message_id;
|
||||||
if !fld_message_id.is_null() {
|
if !fld_message_id.is_null() {
|
||||||
rfc724_mid = dc_strdup((*fld_message_id).mid_value)
|
rfc724_mid = dc_strdup((*fld_message_id).mid_value)
|
||||||
@@ -222,12 +197,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
if strcmp(old_server_folder, server_folder) != 0i32
|
if strcmp(old_server_folder, server_folder) != 0i32
|
||||||
|| old_server_uid != server_uid
|
|| old_server_uid != server_uid
|
||||||
{
|
{
|
||||||
dc_update_server_uid(
|
dc_update_server_uid(context, rfc724_mid, server_folder, server_uid);
|
||||||
context,
|
|
||||||
rfc724_mid,
|
|
||||||
server_folder,
|
|
||||||
server_uid,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
free(old_server_folder as *mut libc::c_void);
|
free(old_server_folder as *mut libc::c_void);
|
||||||
dc_log_info(
|
dc_log_info(
|
||||||
@@ -264,20 +234,13 @@ pub unsafe fn dc_receive_imf(
|
|||||||
if 0 != incoming {
|
if 0 != incoming {
|
||||||
state = if 0 != flags & 0x1 { 16 } else { 10 };
|
state = if 0 != flags & 0x1 { 16 } else { 10 };
|
||||||
to_id = 1 as uint32_t;
|
to_id = 1 as uint32_t;
|
||||||
if !dc_mimeparser_lookup_field(
|
if !dc_mimeparser_lookup_field_r(&mime_parser, "Secure-Join").is_null()
|
||||||
&mime_parser,
|
|
||||||
b"Secure-Join\x00" as *const u8 as *const libc::c_char,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
{
|
{
|
||||||
msgrmsg = 1i32;
|
msgrmsg = 1i32;
|
||||||
chat_id = 0i32 as uint32_t;
|
chat_id = 0i32 as uint32_t;
|
||||||
allow_creation = 1i32;
|
allow_creation = 1i32;
|
||||||
let handshake: libc::c_int = dc_handle_securejoin_handshake(
|
let handshake: libc::c_int =
|
||||||
context,
|
dc_handle_securejoin_handshake(context, &mime_parser, from_id);
|
||||||
&mime_parser,
|
|
||||||
from_id,
|
|
||||||
);
|
|
||||||
if 0 != handshake & 0x2i32 {
|
if 0 != handshake & 0x2i32 {
|
||||||
hidden = 1i32;
|
hidden = 1i32;
|
||||||
add_delete_job = handshake & 0x4i32;
|
add_delete_job = handshake & 0x4i32;
|
||||||
@@ -397,9 +360,8 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if chat_id == 0i32 as libc::c_uint && 0 != allow_creation {
|
if chat_id == 0i32 as libc::c_uint && 0 != allow_creation {
|
||||||
let create_blocked_1: libc::c_int = if 0 != msgrmsg
|
let create_blocked_1: libc::c_int =
|
||||||
&& !dc_is_contact_blocked(context, to_id)
|
if 0 != msgrmsg && !dc_is_contact_blocked(context, to_id) {
|
||||||
{
|
|
||||||
0i32
|
0i32
|
||||||
} else {
|
} else {
|
||||||
2i32
|
2i32
|
||||||
@@ -411,9 +373,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
&mut chat_id,
|
&mut chat_id,
|
||||||
&mut chat_id_blocked,
|
&mut chat_id_blocked,
|
||||||
);
|
);
|
||||||
if 0 != chat_id
|
if 0 != chat_id && 0 != chat_id_blocked && 0 == create_blocked_1
|
||||||
&& 0 != chat_id_blocked
|
|
||||||
&& 0 == create_blocked_1
|
|
||||||
{
|
{
|
||||||
dc_unblock_chat(context, chat_id);
|
dc_unblock_chat(context, chat_id);
|
||||||
chat_id_blocked = 0i32
|
chat_id_blocked = 0i32
|
||||||
@@ -466,8 +426,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
b"\r\n\r\n\x00" as *const u8 as *const libc::c_char,
|
b"\r\n\r\n\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
if !p.is_null() {
|
if !p.is_null() {
|
||||||
header_bytes = (p.wrapping_offset_from(imf_raw_not_terminated)
|
header_bytes = (p.wrapping_offset_from(imf_raw_not_terminated) + 4)
|
||||||
+ 4)
|
|
||||||
as libc::c_int
|
as libc::c_int
|
||||||
} else {
|
} else {
|
||||||
p = strstr(
|
p = strstr(
|
||||||
@@ -475,16 +434,13 @@ pub unsafe fn dc_receive_imf(
|
|||||||
b"\n\n\x00" as *const u8 as *const libc::c_char,
|
b"\n\n\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
if !p.is_null() {
|
if !p.is_null() {
|
||||||
header_bytes =
|
header_bytes = (p.wrapping_offset_from(imf_raw_not_terminated)
|
||||||
(p.wrapping_offset_from(imf_raw_not_terminated) + 2)
|
+ 2)
|
||||||
as libc::c_int
|
as libc::c_int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "In-Reply-To");
|
||||||
&mime_parser,
|
|
||||||
b"In-Reply-To\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null()
|
if !field.is_null()
|
||||||
&& (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int
|
&& (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int
|
||||||
{
|
{
|
||||||
@@ -497,10 +453,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(&mime_parser, "References");
|
||||||
&mime_parser,
|
|
||||||
b"References\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null()
|
if !field.is_null()
|
||||||
&& (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int
|
&& (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int
|
||||||
{
|
{
|
||||||
@@ -624,8 +577,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
dc_log_info(
|
dc_log_info(
|
||||||
context,
|
context,
|
||||||
0i32,
|
0i32,
|
||||||
b"Cannot write DB.\x00" as *const u8
|
b"Cannot write DB.\x00" as *const u8 as *const libc::c_char,
|
||||||
as *const libc::c_char,
|
|
||||||
);
|
);
|
||||||
/* 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;
|
current_block = 16282941964262048061;
|
||||||
@@ -716,17 +668,13 @@ pub unsafe fn dc_receive_imf(
|
|||||||
{
|
{
|
||||||
if strcmp(
|
if strcmp(
|
||||||
(*report_type).pa_value,
|
(*report_type).pa_value,
|
||||||
b"disposition-notification\x00" as *const u8
|
b"disposition-notification\x00" as *const u8 as *const libc::c_char,
|
||||||
as *const libc::c_char,
|
|
||||||
) == 0i32
|
) == 0i32
|
||||||
&& (*(*report_root).mm_data.mm_multipart.mm_mp_list).count
|
&& (*(*report_root).mm_data.mm_multipart.mm_mp_list).count >= 2i32
|
||||||
>= 2i32
|
|
||||||
{
|
{
|
||||||
if 0 != mdns_enabled {
|
if 0 != mdns_enabled {
|
||||||
let report_data: *mut mailmime = (if !if !(*(*report_root)
|
let report_data: *mut mailmime =
|
||||||
.mm_data
|
(if !if !(*(*report_root).mm_data.mm_multipart.mm_mp_list)
|
||||||
.mm_multipart
|
|
||||||
.mm_mp_list)
|
|
||||||
.first
|
.first
|
||||||
.is_null()
|
.is_null()
|
||||||
{
|
{
|
||||||
@@ -751,8 +699,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
.data
|
.data
|
||||||
} else {
|
} else {
|
||||||
0 as *mut libc::c_void
|
0 as *mut libc::c_void
|
||||||
})
|
}) as *mut mailmime;
|
||||||
as *mut mailmime;
|
|
||||||
if !report_data.is_null()
|
if !report_data.is_null()
|
||||||
&& (*(*(*report_data).mm_content_type).ct_type).tp_type
|
&& (*(*(*report_data).mm_content_type).ct_type).tp_type
|
||||||
== MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int
|
== MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int
|
||||||
@@ -800,25 +747,19 @@ pub unsafe fn dc_receive_imf(
|
|||||||
*const u8
|
*const u8
|
||||||
as
|
as
|
||||||
*const libc::c_char);
|
*const libc::c_char);
|
||||||
let of_org_msgid:
|
let of_org_msgid: *mut mailimf_optional_field =
|
||||||
*mut mailimf_optional_field =
|
mailimf_find_optional_field(
|
||||||
mailimf_find_optional_field(report_fields,
|
report_fields,
|
||||||
b"Original-Message-ID\x00"
|
b"Original-Message-ID\x00" as *const u8
|
||||||
as
|
as *const libc::c_char,
|
||||||
*const u8
|
);
|
||||||
as
|
|
||||||
*const libc::c_char);
|
|
||||||
if !of_disposition.is_null()
|
if !of_disposition.is_null()
|
||||||
&& !(*of_disposition)
|
&& !(*of_disposition).fld_value.is_null()
|
||||||
.fld_value
|
|
||||||
.is_null()
|
|
||||||
&& !of_org_msgid.is_null()
|
&& !of_org_msgid.is_null()
|
||||||
&& !(*of_org_msgid).fld_value.is_null()
|
&& !(*of_org_msgid).fld_value.is_null()
|
||||||
{
|
{
|
||||||
let mut rfc724_mid_0:
|
let mut rfc724_mid_0: *mut libc::c_char =
|
||||||
*mut libc::c_char =
|
0 as *mut libc::c_char;
|
||||||
0 as
|
|
||||||
*mut libc::c_char;
|
|
||||||
dummy = 0i32 as size_t;
|
dummy = 0i32 as size_t;
|
||||||
if mailimf_msg_id_parse(
|
if mailimf_msg_id_parse(
|
||||||
(*of_org_msgid).fld_value,
|
(*of_org_msgid).fld_value,
|
||||||
@@ -856,10 +797,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
mdn_consumed = (msg_id
|
mdn_consumed = (msg_id
|
||||||
!= 0i32 as libc::c_uint)
|
!= 0i32 as libc::c_uint)
|
||||||
as libc::c_int;
|
as libc::c_int;
|
||||||
free(
|
free(rfc724_mid_0 as *mut libc::c_void);
|
||||||
rfc724_mid_0
|
|
||||||
as *mut libc::c_void,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -879,8 +817,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
&& 0 != dc_sqlite3_get_config_int(
|
&& 0 != dc_sqlite3_get_config_int(
|
||||||
context,
|
context,
|
||||||
&context.sql,
|
&context.sql,
|
||||||
b"mvbox_move\x00" as *const u8
|
b"mvbox_move\x00" as *const u8 as *const libc::c_char,
|
||||||
as *const libc::c_char,
|
|
||||||
1i32,
|
1i32,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -922,8 +859,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
if !(*mime_parser.location_kml).addr.is_null()
|
if !(*mime_parser.location_kml).addr.is_null()
|
||||||
&& !contact.is_null()
|
&& !contact.is_null()
|
||||||
&& !(*contact).addr.is_null()
|
&& !(*contact).addr.is_null()
|
||||||
&& strcasecmp((*contact).addr, (*mime_parser.location_kml).addr)
|
&& strcasecmp((*contact).addr, (*mime_parser.location_kml).addr) == 0i32
|
||||||
== 0i32
|
|
||||||
{
|
{
|
||||||
let newest_location_id = dc_save_locations(
|
let newest_location_id = dc_save_locations(
|
||||||
context,
|
context,
|
||||||
@@ -933,11 +869,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
if newest_location_id != 0 && hidden == 0 && !location_id_written {
|
if newest_location_id != 0 && hidden == 0 && !location_id_written {
|
||||||
dc_set_msg_location_id(
|
dc_set_msg_location_id(context, insert_msg_id, newest_location_id);
|
||||||
context,
|
|
||||||
insert_msg_id,
|
|
||||||
newest_location_id,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
send_event = true;
|
send_event = true;
|
||||||
}
|
}
|
||||||
@@ -952,9 +884,7 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 != add_delete_job
|
if 0 != add_delete_job && carray_count(created_db_entries) >= 2i32 as libc::c_uint {
|
||||||
&& carray_count(created_db_entries) >= 2i32 as libc::c_uint
|
|
||||||
{
|
|
||||||
dc_job_add(
|
dc_job_add(
|
||||||
context,
|
context,
|
||||||
110i32,
|
110i32,
|
||||||
@@ -967,7 +897,6 @@ pub unsafe fn dc_receive_imf(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(rfc724_mid as *mut libc::c_void);
|
free(rfc724_mid as *mut libc::c_void);
|
||||||
free(mime_in_reply_to as *mut libc::c_void);
|
free(mime_in_reply_to as *mut libc::c_void);
|
||||||
@@ -1113,10 +1042,7 @@ unsafe fn create_or_lookup_group(
|
|||||||
grpid = dc_strdup((*optional_field).fld_value)
|
grpid = dc_strdup((*optional_field).fld_value)
|
||||||
}
|
}
|
||||||
if grpid.is_null() {
|
if grpid.is_null() {
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "Message-ID");
|
||||||
mime_parser,
|
|
||||||
b"Message-ID\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_MESSAGE_ID as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_MESSAGE_ID as libc::c_int {
|
||||||
let fld_message_id: *mut mailimf_message_id = (*field).fld_data.fld_message_id;
|
let fld_message_id: *mut mailimf_message_id = (*field).fld_data.fld_message_id;
|
||||||
if !fld_message_id.is_null() {
|
if !fld_message_id.is_null() {
|
||||||
@@ -1124,10 +1050,7 @@ unsafe fn create_or_lookup_group(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if grpid.is_null() {
|
if grpid.is_null() {
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "In-Reply-To");
|
||||||
mime_parser,
|
|
||||||
b"In-Reply-To\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
||||||
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
||||||
if !fld_in_reply_to.is_null() {
|
if !fld_in_reply_to.is_null() {
|
||||||
@@ -1135,10 +1058,7 @@ unsafe fn create_or_lookup_group(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if grpid.is_null() {
|
if grpid.is_null() {
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "References");
|
||||||
mime_parser,
|
|
||||||
b"References\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int
|
||||||
{
|
{
|
||||||
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
||||||
@@ -1304,12 +1224,7 @@ unsafe fn create_or_lookup_group(
|
|||||||
/*otherwise, a pending "quit" message may pop up*/
|
/*otherwise, a pending "quit" message may pop up*/
|
||||||
/*re-create explicitly left groups only if ourself is re-added*/
|
/*re-create explicitly left groups only if ourself is re-added*/
|
||||||
let mut create_verified: libc::c_int = 0i32;
|
let mut create_verified: libc::c_int = 0i32;
|
||||||
if !dc_mimeparser_lookup_field(
|
if !dc_mimeparser_lookup_field_r(mime_parser, "Chat-Verified").is_null() {
|
||||||
mime_parser,
|
|
||||||
b"Chat-Verified\x00" as *const u8 as *const libc::c_char,
|
|
||||||
)
|
|
||||||
.is_null()
|
|
||||||
{
|
|
||||||
create_verified = 1i32;
|
create_verified = 1i32;
|
||||||
if 0 == check_verified_properties(
|
if 0 == check_verified_properties(
|
||||||
context,
|
context,
|
||||||
@@ -1969,10 +1884,7 @@ unsafe fn dc_is_reply_to_known_message(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut field: *mut mailimf_field;
|
let mut field: *mut mailimf_field;
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "In-Reply-To");
|
||||||
mime_parser,
|
|
||||||
b"In-Reply-To\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
||||||
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
||||||
if !fld_in_reply_to.is_null() {
|
if !fld_in_reply_to.is_null() {
|
||||||
@@ -1984,10 +1896,7 @@ unsafe fn dc_is_reply_to_known_message(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "References");
|
||||||
mime_parser,
|
|
||||||
b"References\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int {
|
||||||
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
||||||
if !fld_references.is_null() {
|
if !fld_references.is_null() {
|
||||||
@@ -2053,10 +1962,7 @@ unsafe fn dc_is_reply_to_messenger_message(
|
|||||||
- it is okay, if the referenced messages are moved to trash here
|
- it is okay, if the referenced messages are moved to trash here
|
||||||
- no check for the Chat-* headers (function is only called if it is no messenger message itself) */
|
- no check for the Chat-* headers (function is only called if it is no messenger message itself) */
|
||||||
let mut field: *mut mailimf_field;
|
let mut field: *mut mailimf_field;
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "In-Reply-To");
|
||||||
mime_parser,
|
|
||||||
b"In-Reply-To\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_IN_REPLY_TO as libc::c_int {
|
||||||
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
let fld_in_reply_to: *mut mailimf_in_reply_to = (*field).fld_data.fld_in_reply_to;
|
||||||
if !fld_in_reply_to.is_null() {
|
if !fld_in_reply_to.is_null() {
|
||||||
@@ -2068,10 +1974,7 @@ unsafe fn dc_is_reply_to_messenger_message(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
field = dc_mimeparser_lookup_field(
|
field = dc_mimeparser_lookup_field_r(mime_parser, "References");
|
||||||
mime_parser,
|
|
||||||
b"References\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int {
|
if !field.is_null() && (*field).fld_type == MAILIMF_FIELD_REFERENCES as libc::c_int {
|
||||||
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
let fld_references: *mut mailimf_references = (*field).fld_data.fld_references;
|
||||||
if !fld_references.is_null() {
|
if !fld_references.is_null() {
|
||||||
|
|||||||
Reference in New Issue
Block a user