From 1ab6645bbc7bb6f18db13e4c8dc3658ad7c3ead9 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 24 Apr 2026 21:41:29 +0200 Subject: [PATCH] api!: remove dc_delete_all_locations --- deltachat-ffi/deltachat.h | 16 +--------------- deltachat-ffi/src/lib.rs | 17 ----------------- deltachat-repl/src/cmdline.rs | 4 ---- deltachat-repl/src/main.rs | 3 +-- src/events/payload.rs | 3 +-- src/location.rs | 7 ------- 6 files changed, 3 insertions(+), 47 deletions(-) diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index cb2caa5f3..928332a98 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -2828,19 +2828,6 @@ int dc_set_location (dc_context_t* context, double latit dc_array_t* dc_get_locations (dc_context_t* context, uint32_t chat_id, uint32_t contact_id, int64_t timestamp_begin, int64_t timestamp_end); -/** - * Delete all locations on the current device. - * Locations already sent cannot be deleted. - * - * Typically results in the event #DC_EVENT_LOCATION_CHANGED - * with contact_id set to 0. - * - * @memberof dc_context_t - * @param context The context object. - */ -void dc_delete_all_locations (dc_context_t* context); - - // misc /** @@ -6426,8 +6413,7 @@ void dc_event_unref(dc_event_t* event); * Location of one or more contact has changed. * * @param data1 (int) contact_id of the contact for which the location has changed. - * If the locations of several contacts have been changed, - * e.g. after calling dc_delete_all_locations(), this parameter is set to 0. + * If the locations of several contacts have been changed, this parameter is set to 0. * @param data2 0 */ #define DC_EVENT_LOCATION_CHANGED 2035 diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index bf45f1e46..e3711cf08 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -2626,23 +2626,6 @@ pub unsafe extern "C" fn dc_get_locations( }) } -#[no_mangle] -pub unsafe extern "C" fn dc_delete_all_locations(context: *mut dc_context_t) { - if context.is_null() { - eprintln!("ignoring careless call to dc_delete_all_locations()"); - return; - } - let ctx = &*context; - - block_on(async move { - location::delete_all(ctx) - .await - .context("Failed to delete locations") - .log_err(ctx) - .ok() - }); -} - #[no_mangle] pub unsafe extern "C" fn dc_create_qr_svg(payload: *const libc::c_char) -> *mut libc::c_char { if payload.is_null() { diff --git a/deltachat-repl/src/cmdline.rs b/deltachat-repl/src/cmdline.rs index 19ae99198..14367fb4d 100644 --- a/deltachat-repl/src/cmdline.rs +++ b/deltachat-repl/src/cmdline.rs @@ -345,7 +345,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu chatinfo\n\ sendlocations \n\ setlocation \n\ - dellocations\n\ getlocations []\n\ send \n\ send-sync \n\ @@ -853,9 +852,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu println!("Success, streaming can be stopped."); } } - "dellocations" => { - location::delete_all(&context).await?; - } "send" => { ensure!(sel_chat.is_some(), "No chat selected."); ensure!(!arg1.is_empty(), "No message text given."); diff --git a/deltachat-repl/src/main.rs b/deltachat-repl/src/main.rs index 1199babc0..652c38088 100644 --- a/deltachat-repl/src/main.rs +++ b/deltachat-repl/src/main.rs @@ -176,7 +176,7 @@ const DB_COMMANDS: [&str; 11] = [ "housekeeping", ]; -const CHAT_COMMANDS: [&str; 40] = [ +const CHAT_COMMANDS: [&str; 39] = [ "listchats", "listarchived", "start-realtime", @@ -194,7 +194,6 @@ const CHAT_COMMANDS: [&str; 40] = [ "chatinfo", "sendlocations", "setlocation", - "dellocations", "getlocations", "send", "send-sync", diff --git a/src/events/payload.rs b/src/events/payload.rs index ee7761f24..a008ce6d1 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -234,8 +234,7 @@ pub enum EventType { /// Location of one or more contact has changed. /// /// @param data1 (u32) contact_id of the contact for which the location has changed. - /// If the locations of several contacts have been changed, - /// eg. after calling dc_delete_all_locations(), this parameter is set to `None`. + /// If the locations of several contacts have been changed, this parameter is set to `None`. LocationChanged(Option), /// Inform about the configuration progress started by configure(). diff --git a/src/location.rs b/src/location.rs index 911bfb831..44371c42e 100644 --- a/src/location.rs +++ b/src/location.rs @@ -459,13 +459,6 @@ fn is_marker(txt: &str) -> bool { } } -/// Deletes all locations from the database. -pub async fn delete_all(context: &Context) -> Result<()> { - context.sql.execute("DELETE FROM locations;", ()).await?; - context.emit_location_changed(None).await?; - Ok(()) -} - /// Deletes expired locations. /// /// Only path locations are deleted.