From be0afdebfdb1b754e4af68d8e0e2c70c906af1d5 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 9 Mar 2020 12:11:01 +0100 Subject: [PATCH] target comments of @link2xt, fix ci --- deltachat-ffi/deltachat.h | 5 +++-- deltachat-ffi/src/lib.rs | 2 +- src/message.rs | 20 +++++--------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 0a8875d2c..a2f5976b0 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -376,11 +376,12 @@ char* dc_get_blobdir (const dc_context_t* context); * - `delete_device_after` = 0=do not delete messages from device automatically (default), * >=1=seconds, after which messages are deleted automatically from the device. * Messages in the "saved messages" chat (see dc_chat_is_self_talk()) are skipped. + * Messages are deleted whether they were seen or not, the UI should clearly point that out. * - `delete_server_after` = 0=do not delete messages from server automatically (default), * >=1=seconds, after which messages are deleted automatically from the server. + * Messages in the "saved messages" chat (see dc_chat_is_self_talk()) are skipped. * Also emails matching the `show_emails` settings above are deleted from the server, * the UI should clearly point that out. - * Messages in the "saved messages" chat (see dc_chat_is_self_talk()) are skipped. * * If you want to retrieve a value, use dc_get_config(). * @@ -1305,7 +1306,7 @@ int dc_get_fresh_msg_cnt (dc_context_t* context, uint32_t ch /** - * Estimte the number of messages that will be deleted + * Estimate the number of messages that will be deleted * by the dc_set_config()-options `delete_device_after` or `delete_server_after`. * This is typically used to show the estimated impact to the user before actually enabling ephemeral messages. * diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index bf07d9f68..f1019650b 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -1058,7 +1058,7 @@ pub unsafe extern "C" fn dc_estimate_deletion_cnt( let ffi_context = &*context; ffi_context .with_inner(|ctx| { - message::estimate_deletion_cnt(ctx, from_server as bool, seconds).unwrap_or(0) + message::estimate_deletion_cnt(ctx, from_server != 0, seconds).unwrap_or(0) as libc::c_int }) .unwrap_or(0) diff --git a/src/message.rs b/src/message.rs index cdc0f525e..b3aa67d00 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1385,17 +1385,10 @@ pub fn estimate_deletion_cnt( "SELECT COUNT(*) FROM msgs m WHERE m.id > ? - AND (state = ? OR state >= ?) - AND chat_id != ? AND timestamp < ? + AND chat_id != ? AND server_uid != 0;", - params![ - DC_MSG_ID_LAST_SPECIAL, - MessageState::InSeen, - MessageState::OutFailed, - self_chat_id, - threshold_timestamp - ], + params![DC_MSG_ID_LAST_SPECIAL, threshold_timestamp, self_chat_id], |row| row.get(0), )?; } else { @@ -1403,16 +1396,13 @@ pub fn estimate_deletion_cnt( "SELECT COUNT(*) FROM msgs m WHERE m.id > ? - AND (state = ? OR state >= ?) - AND chat_id != ? AND timestamp < ? - AND chat_id != ?;", + AND chat_id != ? + AND chat_id != ? AND hidden = 0;", params![ DC_MSG_ID_LAST_SPECIAL, - MessageState::InSeen, - MessageState::OutFailed, - self_chat_id, threshold_timestamp, + self_chat_id, ChatId::new(DC_CHAT_ID_TRASH) ], |row| row.get(0),