mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
Make dc_msg_exists safe and rusty
This commit is contained in:
@@ -1032,25 +1032,23 @@ The value is also used for CC:-summaries */
|
||||
|
||||
// Context functions to work with messages
|
||||
|
||||
pub unsafe fn dc_msg_exists(context: &Context, msg_id: u32) -> libc::c_int {
|
||||
if msg_id <= 9 {
|
||||
return 0;
|
||||
pub fn dc_msg_exists(context: &Context, msg_id: u32) -> bool {
|
||||
if msg_id <= DC_CHAT_ID_LAST_SPECIAL {
|
||||
return false;
|
||||
}
|
||||
|
||||
let chat_id: Option<i32> = context.sql.query_row_col(
|
||||
let chat_id: Option<u32> = context.sql.query_row_col(
|
||||
context,
|
||||
"SELECT chat_id FROM msgs WHERE id=?;",
|
||||
params![msg_id as i32],
|
||||
params![msg_id],
|
||||
0,
|
||||
);
|
||||
|
||||
if let Some(chat_id) = chat_id {
|
||||
if chat_id != 3 {
|
||||
return 1;
|
||||
}
|
||||
chat_id != DC_CHAT_ID_TRASH
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
0
|
||||
}
|
||||
|
||||
pub fn dc_update_msg_move_state(
|
||||
|
||||
Reference in New Issue
Block a user