From e2f9c80cd5fee1190da05fd80825929b3064042f Mon Sep 17 00:00:00 2001 From: bjoern Date: Mon, 31 Mar 2025 15:11:31 +0200 Subject: [PATCH] feat: add name resp. "Me" to contact encryption info (#6720) otherwise, by tuning down the email addresses, one does not really has and idea who is SELF. maybe the dialog is the only way at the end to get the transport adresses of contacts, this is unclear atm, this PR fixes the issue at hand --- src/contact.rs | 24 ++++++++++++++++++++---- src/contact/contact_tests.rs | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/contact.rs b/src/contact.rs index f3044203f..7fa9771d0 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -1277,9 +1277,16 @@ impl Contact { .map(|k| k.dc_fingerprint().to_string()) .unwrap_or_default(); if addr < peerstate.addr { - cat_fingerprint(&mut ret, &addr, &fingerprint_self, ""); cat_fingerprint( &mut ret, + &stock_str::self_msg(context).await, + &addr, + &fingerprint_self, + "", + ); + cat_fingerprint( + &mut ret, + contact.get_display_name(), &peerstate.addr, &fingerprint_other_verified, &fingerprint_other_unverified, @@ -1287,11 +1294,18 @@ impl Contact { } else { cat_fingerprint( &mut ret, + contact.get_display_name(), &peerstate.addr, &fingerprint_other_verified, &fingerprint_other_unverified, ); - cat_fingerprint(&mut ret, &addr, &fingerprint_self, ""); + cat_fingerprint( + &mut ret, + &stock_str::self_msg(context).await, + &addr, + &fingerprint_self, + "", + ); } Ok(ret) @@ -1848,12 +1862,14 @@ pub(crate) async fn update_last_seen( fn cat_fingerprint( ret: &mut String, + name: &str, addr: &str, fingerprint_verified: &str, fingerprint_unverified: &str, ) { *ret += &format!( - "\n\n{}:\n{}", + "\n\n{} ({}):\n{}", + name, addr, if !fingerprint_verified.is_empty() { fingerprint_verified @@ -1865,7 +1881,7 @@ fn cat_fingerprint( && !fingerprint_unverified.is_empty() && fingerprint_verified != fingerprint_unverified { - *ret += &format!("\n\n{addr} (alternative):\n{fingerprint_unverified}"); + *ret += &format!("\n\n{name} (alternative):\n{fingerprint_unverified}"); } } diff --git a/src/contact/contact_tests.rs b/src/contact/contact_tests.rs index c789bdd11..98724cc9d 100644 --- a/src/contact/contact_tests.rs +++ b/src/contact/contact_tests.rs @@ -763,11 +763,11 @@ async fn test_contact_get_encrinfo() -> Result<()> { "End-to-end encryption preferred. Fingerprints: -alice@example.org: +Me (alice@example.org): 2E6F A2CB 23B5 32D7 2863 4B58 64B0 8F61 A9ED 9443 -bob@example.net: +Bob (bob@example.net): CCCB 5AA9 F6E1 141C 9431 65F1 DB18 B18C BCF7 0487" );