feat: add location streaming failure response code

Before `is_sending_location_to_chat` returned a boolean when location was enabled or disabled for a chat. It now returns an enum value representing Enabled, disabled and failure where failure says that its enabled but (currently) not possible. This should not break cffi because 0 is still disabled, 1 enabled and new code 2 (failure) is handled similar to 1.
This commit is contained in:
Septias
2024-11-10 17:32:11 +01:00
parent 3b2f18f926
commit 092b6e96ea
4 changed files with 44 additions and 10 deletions

View File

@@ -2520,8 +2520,10 @@ pub unsafe extern "C" fn dc_is_sending_locations_to_chat(
Some(ChatId::new(chat_id))
};
block_on(location::is_sending_locations_to_chat(ctx, chat_id))
.unwrap_or_log_default(ctx, "Failed dc_is_sending_locations_to_chat()") as libc::c_int
block_on(async {
location::is_sending_locations_to_chat(ctx, chat_id).await.map(|res| res as u8)
})
.unwrap_or_log_default(ctx, "Failed dc_is_sending_locations_to_chat()") as libc::c_int
}
#[no_mangle]