mirror of
https://github.com/chatmail/core.git
synced 2026-05-15 12:56:30 +03:00
Change type of dc_mimepart_t.is_meta to bool
This commit is contained in:
@@ -32,7 +32,7 @@ dc_mimeparser_t has no deep dependencies to Context or to the database
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct dc_mimepart_t {
|
pub struct dc_mimepart_t {
|
||||||
pub type_0: Viewtype,
|
pub type_0: Viewtype,
|
||||||
pub is_meta: libc::c_int,
|
pub is_meta: bool,
|
||||||
pub int_mimetype: libc::c_int,
|
pub int_mimetype: libc::c_int,
|
||||||
pub msg: Option<String>,
|
pub msg: Option<String>,
|
||||||
pub msg_raw: *mut libc::c_char,
|
pub msg_raw: *mut libc::c_char,
|
||||||
@@ -196,7 +196,7 @@ pub unsafe fn dc_mimeparser_parse<'a>(context: &'a Context, body: &[u8]) -> dc_m
|
|||||||
if mimeparser.parts.len() >= 2 {
|
if mimeparser.parts.len() >= 2 {
|
||||||
let imgpart = &mut mimeparser.parts[1];
|
let imgpart = &mut mimeparser.parts[1];
|
||||||
if imgpart.type_0 == Viewtype::Image {
|
if imgpart.type_0 == Viewtype::Image {
|
||||||
imgpart.is_meta = 1i32
|
imgpart.is_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ pub unsafe fn dc_mimeparser_parse<'a>(context: &'a Context, body: &[u8]) -> dc_m
|
|||||||
|| filepart.type_0 == Viewtype::Voice
|
|| filepart.type_0 == Viewtype::Voice
|
||||||
|| filepart.type_0 == Viewtype::Video
|
|| filepart.type_0 == Viewtype::Video
|
||||||
|| filepart.type_0 == Viewtype::File)
|
|| filepart.type_0 == Viewtype::File)
|
||||||
&& 0 == filepart.is_meta
|
&& !filepart.is_meta
|
||||||
};
|
};
|
||||||
|
|
||||||
if need_drop {
|
if need_drop {
|
||||||
@@ -366,7 +366,7 @@ pub unsafe fn dc_mimeparser_parse<'a>(context: &'a Context, body: &[u8]) -> dc_m
|
|||||||
unsafe fn dc_mimepart_new() -> dc_mimepart_t {
|
unsafe fn dc_mimepart_new() -> dc_mimepart_t {
|
||||||
dc_mimepart_t {
|
dc_mimepart_t {
|
||||||
type_0: Viewtype::Unknown,
|
type_0: Viewtype::Unknown,
|
||||||
is_meta: 0,
|
is_meta: false,
|
||||||
int_mimetype: 0,
|
int_mimetype: 0,
|
||||||
msg: None,
|
msg: None,
|
||||||
msg_raw: std::ptr::null_mut(),
|
msg_raw: std::ptr::null_mut(),
|
||||||
@@ -378,11 +378,7 @@ unsafe fn dc_mimepart_new() -> dc_mimepart_t {
|
|||||||
pub fn dc_mimeparser_get_last_nonmeta<'a>(
|
pub fn dc_mimeparser_get_last_nonmeta<'a>(
|
||||||
mimeparser: &'a mut dc_mimeparser_t,
|
mimeparser: &'a mut dc_mimeparser_t,
|
||||||
) -> Option<&'a mut dc_mimepart_t> {
|
) -> Option<&'a mut dc_mimepart_t> {
|
||||||
mimeparser
|
mimeparser.parts.iter_mut().rev().find(|part| !part.is_meta)
|
||||||
.parts
|
|
||||||
.iter_mut()
|
|
||||||
.rev()
|
|
||||||
.find(|part| part.is_meta == 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*the result must be freed*/
|
/*the result must be freed*/
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ unsafe fn add_parts(
|
|||||||
|mut stmt, conn| {
|
|mut stmt, conn| {
|
||||||
for i in 0..icnt {
|
for i in 0..icnt {
|
||||||
let part = &mut mime_parser.parts[i];
|
let part = &mut mime_parser.parts[i];
|
||||||
if part.is_meta != 0 {
|
if part.is_meta {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user