diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 9467f33fe..cd0f1571a 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -850,7 +850,7 @@ fn save_locations( if mime_parser.message_kml.is_some() { let locations = &mime_parser.message_kml.as_ref().unwrap().locations; let newest_location_id = - location::save(context, chat_id, from_id, locations, 1).unwrap_or_default(); + location::save(context, chat_id, from_id, locations, true).unwrap_or_default(); if 0 != newest_location_id && 0 == hidden { if location::set_msg_location_id(context, insert_msg_id, newest_location_id).is_ok() { location_id_written = true; @@ -865,7 +865,8 @@ fn save_locations( if contact.get_addr().to_lowercase() == addr.to_lowercase() { let locations = &mime_parser.location_kml.as_ref().unwrap().locations; let newest_location_id = - location::save(context, chat_id, from_id, locations, 0).unwrap_or_default(); + location::save(context, chat_id, from_id, locations, false) + .unwrap_or_default(); if newest_location_id != 0 && hidden == 0 && !location_id_written { if let Err(err) = location::set_msg_location_id( context, diff --git a/src/location.rs b/src/location.rs index 14ef83dda..7b658f92d 100644 --- a/src/location.rs +++ b/src/location.rs @@ -492,7 +492,7 @@ pub fn save( chat_id: u32, contact_id: u32, locations: &[Location], - independent: i32, + independent: bool, ) -> Result { ensure!(chat_id > DC_CHAT_ID_LAST_SPECIAL, "Invalid chat id"); context.sql.prepare2( @@ -507,7 +507,7 @@ pub fn save( for location in locations { let exists = stmt_test.exists(params![location.timestamp, contact_id as i32])?; - if 0 != independent || !exists { + if independent || !exists { stmt_insert.execute(params![ location.timestamp, contact_id as i32,