mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
Merge pull request #271 from link2xt/reports_vec
Replace dc_mimeparser_t::reports carray with Vec
This commit is contained in:
@@ -55,7 +55,7 @@ pub struct dc_mimeparser_t<'a> {
|
||||
pub e2ee_helper: dc_e2ee_helper_t,
|
||||
pub is_forwarded: libc::c_int,
|
||||
pub context: &'a Context,
|
||||
pub reports: *mut carray,
|
||||
pub reports: Vec<*mut mailmime>,
|
||||
pub is_system_message: libc::c_int,
|
||||
pub location_kml: Option<dc_kml_t>,
|
||||
pub message_kml: Option<dc_kml_t>,
|
||||
@@ -82,7 +82,7 @@ pub unsafe fn dc_mimeparser_new(context: &Context) -> dc_mimeparser_t {
|
||||
e2ee_helper: Default::default(),
|
||||
is_forwarded: 0,
|
||||
context,
|
||||
reports: carray_new(16i32 as libc::c_uint),
|
||||
reports: Vec::new(),
|
||||
is_system_message: 0,
|
||||
location_kml: None,
|
||||
message_kml: None,
|
||||
@@ -94,9 +94,6 @@ pub unsafe fn dc_mimeparser_unref(mimeparser: &mut dc_mimeparser_t) {
|
||||
if !(*mimeparser).parts.is_null() {
|
||||
carray_free((*mimeparser).parts);
|
||||
}
|
||||
if !(*mimeparser).reports.is_null() {
|
||||
carray_free((*mimeparser).reports);
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn dc_mimeparser_empty(mimeparser: &mut dc_mimeparser_t) {
|
||||
@@ -128,9 +125,7 @@ pub unsafe fn dc_mimeparser_empty(mimeparser: &mut dc_mimeparser_t) {
|
||||
(*mimeparser).mimeroot = 0 as *mut mailmime
|
||||
}
|
||||
(*mimeparser).is_forwarded = 0i32;
|
||||
if !(*mimeparser).reports.is_null() {
|
||||
carray_set_size((*mimeparser).reports, 0i32 as libc::c_uint);
|
||||
}
|
||||
(*mimeparser).reports.clear();
|
||||
(*mimeparser).decrypting_failed = 0i32;
|
||||
dc_e2ee_thanks(&mut (*mimeparser).e2ee_helper);
|
||||
|
||||
@@ -396,9 +391,7 @@ pub unsafe fn dc_mimeparser_parse(
|
||||
}
|
||||
}
|
||||
/* Cleanup - and try to create at least an empty part if there are no parts yet */
|
||||
if dc_mimeparser_get_last_nonmeta(mimeparser).is_null()
|
||||
&& carray_count((*mimeparser).reports) == 0i32 as libc::c_uint
|
||||
{
|
||||
if dc_mimeparser_get_last_nonmeta(mimeparser).is_null() && (*mimeparser).reports.is_empty() {
|
||||
let mut part_5 = dc_mimepart_new();
|
||||
part_5.type_0 = 10i32;
|
||||
if !(*mimeparser).subject.is_null() && 0 == (*mimeparser).is_send_by_messenger {
|
||||
@@ -705,11 +698,7 @@ unsafe fn dc_mimeparser_parse_mime_recursive(
|
||||
b"disposition-notification\x00" as *const u8 as *const libc::c_char,
|
||||
) == 0i32
|
||||
{
|
||||
carray_add(
|
||||
(*mimeparser).reports,
|
||||
mime as *mut libc::c_void,
|
||||
0 as *mut libc::c_uint,
|
||||
);
|
||||
(*mimeparser).reports.push(mime);
|
||||
} else {
|
||||
any_part_added = dc_mimeparser_parse_mime_recursive(
|
||||
mimeparser,
|
||||
|
||||
@@ -51,8 +51,6 @@ pub unsafe fn dc_receive_imf(
|
||||
let mut add_delete_job: libc::c_int = 0;
|
||||
let mut insert_msg_id: uint32_t = 0 as uint32_t;
|
||||
|
||||
let mut i: size_t;
|
||||
let mut icnt: size_t;
|
||||
/* Message-ID from the header */
|
||||
let mut rfc724_mid = 0 as *mut libc::c_char;
|
||||
let mut sort_timestamp = 0;
|
||||
@@ -437,7 +435,7 @@ pub unsafe fn dc_receive_imf(
|
||||
)
|
||||
}
|
||||
}
|
||||
icnt = carray_count(mime_parser.parts) as size_t;
|
||||
let icnt = carray_count(mime_parser.parts) as size_t;
|
||||
|
||||
context.sql.prepare(
|
||||
"INSERT INTO msgs \
|
||||
@@ -588,17 +586,13 @@ pub unsafe fn dc_receive_imf(
|
||||
match current_block {
|
||||
16282941964262048061 => {}
|
||||
_ => {
|
||||
if carray_count(mime_parser.reports) > 0 as libc::c_uint {
|
||||
if !mime_parser.reports.is_empty() {
|
||||
let mdns_enabled = context
|
||||
.sql
|
||||
.get_config_int(context, "mdns_enabled")
|
||||
.unwrap_or_else(|| 1);
|
||||
icnt = carray_count(mime_parser.reports) as size_t;
|
||||
i = 0 as size_t;
|
||||
while i < icnt {
|
||||
for report_root in mime_parser.reports {
|
||||
let mut mdn_consumed: libc::c_int = 0;
|
||||
let report_root: *mut mailmime =
|
||||
carray_get(mime_parser.reports, i as libc::c_uint) as *mut mailmime;
|
||||
let report_type: *mut mailmime_parameter = mailmime_find_ct_parameter(
|
||||
report_root,
|
||||
b"report-type\x00" as *const u8 as *const libc::c_char,
|
||||
@@ -757,7 +751,6 @@ pub unsafe fn dc_receive_imf(
|
||||
}
|
||||
}
|
||||
}
|
||||
i = i.wrapping_add(1)
|
||||
}
|
||||
}
|
||||
if !mime_parser.message_kml.is_none() && chat_id > 9 as libc::c_uint {
|
||||
|
||||
Reference in New Issue
Block a user