From 8015ba1d6409e5f41e20b0c219e12483b7f0bc51 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 26 Oct 2019 18:37:33 +0200 Subject: [PATCH 1/2] dc_get_chat_id_by_contact_id() returns 0 if no chat is found. this is no error; in fact, the function is used to probe if there is a chat with a given contact at several places eg. in the android-ui. --- deltachat-ffi/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index cb8a1d0d5..242216844 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -717,7 +717,7 @@ pub unsafe extern "C" fn dc_get_chat_id_by_contact_id( ffi_context .with_inner(|ctx| { chat::get_by_contact_id(ctx, contact_id) - .unwrap_or_log_default(ctx, "Failed to get chat") + .unwrap_or(0) }) .unwrap_or(0) } From 51f43842cf2a4da0c2b687d8ca9e3fe2748f6179 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sun, 27 Oct 2019 11:42:56 +0100 Subject: [PATCH 2/2] cargo fmt --- deltachat-ffi/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 242216844..516dce48f 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -715,10 +715,7 @@ pub unsafe extern "C" fn dc_get_chat_id_by_contact_id( } let ffi_context = &*context; ffi_context - .with_inner(|ctx| { - chat::get_by_contact_id(ctx, contact_id) - .unwrap_or(0) - }) + .with_inner(|ctx| chat::get_by_contact_id(ctx, contact_id).unwrap_or(0)) .unwrap_or(0) }