diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 507fd7de5..ab8b7ffce 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1361,7 +1361,7 @@ pub unsafe extern "C" fn dc_msg_is_sent(msg: *mut dc_msg::dc_msg_t) -> libc::c_i #[no_mangle] pub unsafe extern "C" fn dc_msg_is_starred(msg: *mut dc_msg::dc_msg_t) -> libc::c_int { - dc_msg::dc_msg_is_starred(msg) + dc_msg::dc_msg_is_starred(msg).into() } #[no_mangle] diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index d05432ace..960446fa5 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -246,11 +246,7 @@ unsafe fn log_msg(context: &Context, prefix: impl AsRef, msg: *mut dc_msg_t as_str(contact_name), contact_id, as_str(msgtext), - if 0 != dc_msg_is_starred(msg) { - "★" - } else { - "" - }, + if dc_msg_is_starred(msg) { "★" } else { "" }, if dc_msg_get_from_id(msg) == 1 as libc::c_uint { "" } else if dc_msg_get_state(msg) == DC_STATE_IN_SEEN { diff --git a/src/dc_msg.rs b/src/dc_msg.rs index 6df04d5cb..df4ed8bfe 100644 --- a/src/dc_msg.rs +++ b/src/dc_msg.rs @@ -949,12 +949,11 @@ pub unsafe fn dc_msg_is_sent(msg: *const dc_msg_t) -> libc::c_int { } } -// TODO should return bool /rtn -pub unsafe fn dc_msg_is_starred(msg: *const dc_msg_t) -> libc::c_int { +pub unsafe fn dc_msg_is_starred(msg: *const dc_msg_t) -> bool { if msg.is_null() || (*msg).magic != 0x11561156i32 as libc::c_uint { - return 0i32; + return false; } - return if 0 != (*msg).starred { 1i32 } else { 0i32 }; + 0 != (*msg).starred } // TODO should return bool /rtn