api!: remove dc_delete_all_locations

This commit is contained in:
link2xt
2026-04-24 21:41:29 +02:00
committed by l
parent c17d067a1a
commit 1ab6645bbc
6 changed files with 3 additions and 47 deletions

View File

@@ -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); 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 // misc
/** /**
@@ -6426,8 +6413,7 @@ void dc_event_unref(dc_event_t* event);
* Location of one or more contact has changed. * Location of one or more contact has changed.
* *
* @param data1 (int) contact_id of the contact for which the location 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, * If the locations of several contacts have been changed, this parameter is set to 0.
* e.g. after calling dc_delete_all_locations(), this parameter is set to 0.
* @param data2 0 * @param data2 0
*/ */
#define DC_EVENT_LOCATION_CHANGED 2035 #define DC_EVENT_LOCATION_CHANGED 2035

View File

@@ -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] #[no_mangle]
pub unsafe extern "C" fn dc_create_qr_svg(payload: *const libc::c_char) -> *mut libc::c_char { pub unsafe extern "C" fn dc_create_qr_svg(payload: *const libc::c_char) -> *mut libc::c_char {
if payload.is_null() { if payload.is_null() {

View File

@@ -345,7 +345,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
chatinfo\n\ chatinfo\n\
sendlocations <seconds>\n\ sendlocations <seconds>\n\
setlocation <lat> <lng>\n\ setlocation <lat> <lng>\n\
dellocations\n\
getlocations [<contact-id>]\n\ getlocations [<contact-id>]\n\
send <text>\n\ send <text>\n\
send-sync <text>\n\ send-sync <text>\n\
@@ -853,9 +852,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
println!("Success, streaming can be stopped."); println!("Success, streaming can be stopped.");
} }
} }
"dellocations" => {
location::delete_all(&context).await?;
}
"send" => { "send" => {
ensure!(sel_chat.is_some(), "No chat selected."); ensure!(sel_chat.is_some(), "No chat selected.");
ensure!(!arg1.is_empty(), "No message text given."); ensure!(!arg1.is_empty(), "No message text given.");

View File

@@ -176,7 +176,7 @@ const DB_COMMANDS: [&str; 11] = [
"housekeeping", "housekeeping",
]; ];
const CHAT_COMMANDS: [&str; 40] = [ const CHAT_COMMANDS: [&str; 39] = [
"listchats", "listchats",
"listarchived", "listarchived",
"start-realtime", "start-realtime",
@@ -194,7 +194,6 @@ const CHAT_COMMANDS: [&str; 40] = [
"chatinfo", "chatinfo",
"sendlocations", "sendlocations",
"setlocation", "setlocation",
"dellocations",
"getlocations", "getlocations",
"send", "send",
"send-sync", "send-sync",

View File

@@ -234,8 +234,7 @@ pub enum EventType {
/// Location of one or more contact has changed. /// Location of one or more contact has changed.
/// ///
/// @param data1 (u32) contact_id of the contact for which the location 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, /// If the locations of several contacts have been changed, this parameter is set to `None`.
/// eg. after calling dc_delete_all_locations(), this parameter is set to `None`.
LocationChanged(Option<ContactId>), LocationChanged(Option<ContactId>),
/// Inform about the configuration progress started by configure(). /// Inform about the configuration progress started by configure().

View File

@@ -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. /// Deletes expired locations.
/// ///
/// Only path locations are deleted. /// Only path locations are deleted.