Skip to content

Commit e2f9c80

Browse files
authored
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
1 parent 394cba3 commit e2f9c80

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/contact.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,21 +1277,35 @@ impl Contact {
12771277
.map(|k| k.dc_fingerprint().to_string())
12781278
.unwrap_or_default();
12791279
if addr < peerstate.addr {
1280-
cat_fingerprint(&mut ret, &addr, &fingerprint_self, "");
12811280
cat_fingerprint(
12821281
&mut ret,
1282+
&stock_str::self_msg(context).await,
1283+
&addr,
1284+
&fingerprint_self,
1285+
"",
1286+
);
1287+
cat_fingerprint(
1288+
&mut ret,
1289+
contact.get_display_name(),
12831290
&peerstate.addr,
12841291
&fingerprint_other_verified,
12851292
&fingerprint_other_unverified,
12861293
);
12871294
} else {
12881295
cat_fingerprint(
12891296
&mut ret,
1297+
contact.get_display_name(),
12901298
&peerstate.addr,
12911299
&fingerprint_other_verified,
12921300
&fingerprint_other_unverified,
12931301
);
1294-
cat_fingerprint(&mut ret, &addr, &fingerprint_self, "");
1302+
cat_fingerprint(
1303+
&mut ret,
1304+
&stock_str::self_msg(context).await,
1305+
&addr,
1306+
&fingerprint_self,
1307+
"",
1308+
);
12951309
}
12961310

12971311
Ok(ret)
@@ -1848,12 +1862,14 @@ pub(crate) async fn update_last_seen(
18481862

18491863
fn cat_fingerprint(
18501864
ret: &mut String,
1865+
name: &str,
18511866
addr: &str,
18521867
fingerprint_verified: &str,
18531868
fingerprint_unverified: &str,
18541869
) {
18551870
*ret += &format!(
1856-
"\n\n{}:\n{}",
1871+
"\n\n{} ({}):\n{}",
1872+
name,
18571873
addr,
18581874
if !fingerprint_verified.is_empty() {
18591875
fingerprint_verified
@@ -1865,7 +1881,7 @@ fn cat_fingerprint(
18651881
&& !fingerprint_unverified.is_empty()
18661882
&& fingerprint_verified != fingerprint_unverified
18671883
{
1868-
*ret += &format!("\n\n{addr} (alternative):\n{fingerprint_unverified}");
1884+
*ret += &format!("\n\n{name} (alternative):\n{fingerprint_unverified}");
18691885
}
18701886
}
18711887

src/contact/contact_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,11 @@ async fn test_contact_get_encrinfo() -> Result<()> {
763763
"End-to-end encryption preferred.
764764
Fingerprints:
765765
766-
alice@example.org:
766+
Me (alice@example.org):
767767
2E6F A2CB 23B5 32D7 2863
768768
4B58 64B0 8F61 A9ED 9443
769769
770-
bob@example.net:
770+
Bob (bob@example.net):
771771
CCCB 5AA9 F6E1 141C 9431
772772
65F1 DB18 B18C BCF7 0487"
773773
);

0 commit comments

Comments
 (0)