api!: remove default value for "addr" config

"addr" is already deprecated and its default value was using "configured_addr".
We want to get rid of "configured_addr" too, but users should at least
not access it through deprecated config.
This commit is contained in:
link2xt
2026-09-17 12:46:43 +00:00
committed by l
parent 6b1d982cfc
commit 3858c47ceb
9 changed files with 30 additions and 27 deletions
-1
View File
@@ -549,7 +549,6 @@ impl Context {
// Default values
let val = match key {
Config::ConfiguredInboxFolder => Some("INBOX".to_string()),
Config::Addr => self.get_config_opt(Config::ConfiguredAddr).await?,
_ => key.get_str("default").map(|s| s.to_string()),
};
Ok(val)
+2 -2
View File
@@ -1219,7 +1219,7 @@ async fn test_make_n_import_vcard() -> Result<()> {
tokio::fs::write(&avatar_path, avatar_bytes).await?;
bob.set_config(Config::Selfavatar, Some(avatar_path.to_str().unwrap()))
.await?;
let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
let bob_addr = bob.get_config(Config::ConfiguredAddr).await?.unwrap();
let bob_biography = bob.get_config(Config::Selfstatus).await?.unwrap();
let chat = bob.create_chat(alice).await;
let sent_msg = bob.send_text(chat.id, "moin").await;
@@ -1315,7 +1315,7 @@ async fn test_make_n_import_vcard() -> Result<()> {
async fn test_import_vcard_key_change() -> Result<()> {
let alice = &TestContext::new_alice().await;
let bob = &TestContext::new_bob().await;
let bob_addr = &bob.get_config(Config::Addr).await?.unwrap();
let bob_addr = &bob.get_config(Config::ConfiguredAddr).await?.unwrap();
bob.set_config(Config::Displayname, Some("Bob")).await?;
let vcard = make_vcard(bob, &[ContactId::SELF]).await?;
alice.evtracker.clear_events();
+1 -1
View File
@@ -961,7 +961,7 @@ mod tests {
assert!(context2.is_configured().await?);
assert_eq!(
context2.get_config(Config::Addr).await?,
context2.get_config(Config::ConfiguredAddr).await?,
Some("alice@example.org".to_string())
);
Ok(())
+4 -1
View File
@@ -1178,7 +1178,10 @@ impl MimeFactory {
};
let self_name = &match self_name {
Some(name) => name,
None => context.get_config(Config::Addr).await?.unwrap_or_default(),
None => context
.get_config(Config::ConfiguredAddr)
.await?
.unwrap_or_default(),
};
stock_str::subject_for_new_contact(context, self_name)
}
+5 -5
View File
@@ -709,9 +709,9 @@ async fn test_remove_member_bcc() -> Result<()> {
let charlie = &tcm.charlie().await;
alice.allow_unencrypted().await?;
let alice_addr = alice.get_config(Config::Addr).await?.unwrap();
let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
let charlie_addr = charlie.get_config(Config::Addr).await?.unwrap();
let alice_addr = alice.get_config(Config::ConfiguredAddr).await?.unwrap();
let bob_addr = bob.get_config(Config::ConfiguredAddr).await?.unwrap();
let charlie_addr = charlie.get_config(Config::ConfiguredAddr).await?.unwrap();
let bob_id = alice.add_or_lookup_address_contact_id(bob).await;
let charlie_id = alice.add_or_lookup_address_contact_id(charlie).await;
@@ -874,7 +874,7 @@ async fn test_new_member_is_first_recipient() -> Result<()> {
assert!(
sent_msg
.recipients
.starts_with(&charlie.get_config(Config::Addr).await?.unwrap())
.starts_with(&charlie.get_config(Config::ConfiguredAddr).await?.unwrap())
);
remove_contact_from_chat(alice, group, bob_id).await?;
@@ -885,7 +885,7 @@ async fn test_new_member_is_first_recipient() -> Result<()> {
assert!(
sent_msg
.recipients
.starts_with(&bob.get_config(Config::Addr).await?.unwrap())
.starts_with(&bob.get_config(Config::ConfiguredAddr).await?.unwrap())
);
Ok(())
}
@@ -131,7 +131,7 @@ async fn test_broadcast_security_attacker_signature() -> Result<()> {
let secret = load_broadcast_secret(alice, alice_chat_id).await?.unwrap();
let charlie_addr = charlie.get_config(Config::Addr).await?.unwrap();
let charlie_addr = charlie.get_config(Config::ConfiguredAddr).await?.unwrap();
test_shared_secret_decryption_ext(
bob,
@@ -183,10 +183,7 @@ async fn test_broadcast_security_happy_path() -> Result<()> {
let secret = load_broadcast_secret(alice, alice_chat_id).await?.unwrap();
let alice_addr = alice
.get_config(crate::config::Config::Addr)
.await?
.unwrap();
let alice_addr = alice.get_config(Config::ConfiguredAddr).await?.unwrap();
test_shared_secret_decryption_ext(bob, &alice_addr, &secret, Some(alice), None).await
}
@@ -205,7 +202,7 @@ async fn test_qr_code_security() -> Result<()> {
// Start a securejoin process, but don't finish it:
join_securejoin(bob, &qr).await?;
let charlie_addr = charlie.get_config(Config::Addr).await?.unwrap();
let charlie_addr = charlie.get_config(Config::ConfiguredAddr).await?.unwrap();
let alice_fp = self_fingerprint(alice).await?;
let secret_for_encryption = format!("securejoin/{alice_fp}/{authcode}");
+4 -4
View File
@@ -3847,7 +3847,7 @@ async fn test_unsigned_chat_group_hdr() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
let bob_addr = bob.get_config(Config::ConfiguredAddr).await?.unwrap();
let bob_id = alice.add_or_lookup_contact_id(bob).await;
let alice_chat_id = create_group(alice, "foos").await?;
add_contact_to_chat(alice, alice_chat_id, bob_id).await?;
@@ -4535,7 +4535,7 @@ async fn test_outgoing_msg_forgery() -> Result<()> {
let mut tcm = TestContextManager::new();
let export_dir = tempfile::tempdir().unwrap();
let alice = &tcm.alice().await;
let alice_addr = &alice.get_config(Config::Addr).await?.unwrap();
let alice_addr = &alice.get_config(Config::ConfiguredAddr).await?.unwrap();
imex(alice, ImexMode::ExportSelfKeys, export_dir.path(), None).await?;
// We need Bob only to encrypt the forged message to Alice's key, actually Bob doesn't
// participate in the scenario.
@@ -5632,7 +5632,7 @@ async fn test_bcc_not_a_group() -> Result<()> {
async fn test_lookup_key_contact_by_address_self() -> Result<()> {
let mut tcm = TestContextManager::new();
let t = &tcm.alice().await;
let addr = &t.get_config(Config::Addr).await?.unwrap();
let addr = &t.get_config(Config::ConfiguredAddr).await?.unwrap();
assert_eq!(
lookup_key_contact_by_address(t, addr, None).await?,
Some(ContactId::SELF)
@@ -5685,7 +5685,7 @@ async fn test_outgoing_determined_by_signature() -> Result<()> {
alice_dev2.configure_addr(different_from).await;
key::store_self_keypair(alice_dev2, &alice_keypair()).await?;
assert_ne!(
alice.get_config(Config::Addr).await?.unwrap(),
alice.get_config(Config::ConfiguredAddr).await?.unwrap(),
different_from
);
+5 -1
View File
@@ -48,7 +48,11 @@ async fn test_setup_contact_ext(case: SetupContactCase) -> (TestContext, TestCon
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let alice_addr = &alice.get_config(Config::Addr).await.unwrap().unwrap();
let alice_addr = &alice
.get_config(Config::ConfiguredAddr)
.await
.unwrap()
.unwrap();
if case == SetupContactCase::AliceHasName {
alice
.set_config(Config::Displayname, Some("Alice"))