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

@@ -629,7 +629,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
);
}
}
if location::is_sending_locations_to_chat(&context, None).await? {
if location::is_sending_locations_to_chat(&context, None).await? != location::LocationSendingStatus::Disabled {
println!("Location streaming enabled.");
}
println!("{cnt} chats");
@@ -841,7 +841,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
println!(
"Location streaming: {}",
"Location streaming: {:?}",
location::is_sending_locations_to_chat(
&context,
Some(sel_chat.as_ref().unwrap().get_id())