mirror of
https://github.com/chatmail/core.git
synced 2026-07-23 03:13:06 +03:00
Revert "fix: use new QR-contained addresses when alice and bob have dropped their singular relay and added a new one and then perform a securejoin"
This reverts commit a9d19bc020.
This commit is contained in:
@@ -1026,9 +1026,7 @@ impl Contact {
|
||||
|| row_authname.is_empty());
|
||||
|
||||
row_id = id;
|
||||
let qr_with_fingerprint = !fingerprint.is_empty()
|
||||
&& origin == Origin::UnhandledSecurejoinQrScan;
|
||||
if (origin >= row_origin || qr_with_fingerprint) && addr != row_addr {
|
||||
if origin >= row_origin && addr != row_addr {
|
||||
update_addr = true;
|
||||
}
|
||||
if update_name || update_authname || update_addr || origin > row_origin {
|
||||
|
||||
@@ -271,7 +271,9 @@ impl MimeFactory {
|
||||
|
||||
let public_key = SignedPublicKey::from_slice(&public_key_bytes)?;
|
||||
|
||||
recipients.extend(relay_addrs(&public_key, &addr));
|
||||
let relays =
|
||||
addresses_from_public_key(&public_key).unwrap_or_else(|| vec![addr.clone()]);
|
||||
recipients.extend(relays);
|
||||
to.push((authname, addr.clone()));
|
||||
|
||||
encryption_pubkeys = Some(vec![(addr, public_key)]);
|
||||
@@ -351,7 +353,7 @@ impl MimeFactory {
|
||||
};
|
||||
if add_timestamp >= remove_timestamp {
|
||||
let relays = if let Some(public_key) = public_key_opt {
|
||||
let addrs = relay_addrs(&public_key, &addr);
|
||||
let addrs = addresses_from_public_key(&public_key);
|
||||
keys.push((addr.clone(), public_key));
|
||||
addrs
|
||||
} else if id != ContactId::SELF && !should_encrypt_symmetrically(&msg, &chat) {
|
||||
@@ -359,10 +361,10 @@ impl MimeFactory {
|
||||
if is_encrypted {
|
||||
warn!(context, "Missing key for {addr}");
|
||||
}
|
||||
vec![addr.clone()]
|
||||
None
|
||||
} else {
|
||||
vec![addr.clone()]
|
||||
};
|
||||
None
|
||||
}.unwrap_or_else(|| vec![addr.clone()]);
|
||||
|
||||
if !recipients_contain_addr(&to, &addr) {
|
||||
if id != ContactId::SELF {
|
||||
@@ -391,7 +393,7 @@ impl MimeFactory {
|
||||
if let Some(email_to_remove) = email_to_remove
|
||||
&& email_to_remove == addr {
|
||||
let relays = if let Some(public_key) = public_key_opt {
|
||||
let addrs = relay_addrs(&public_key, &addr);
|
||||
let addrs = addresses_from_public_key(&public_key);
|
||||
keys.push((addr.clone(), public_key));
|
||||
addrs
|
||||
} else if id != ContactId::SELF && !should_encrypt_symmetrically(&msg, &chat) {
|
||||
@@ -399,10 +401,10 @@ impl MimeFactory {
|
||||
if is_encrypted {
|
||||
warn!(context, "Missing key for {addr}");
|
||||
}
|
||||
vec![addr.clone()]
|
||||
None
|
||||
} else {
|
||||
vec![addr.clone()]
|
||||
};
|
||||
None
|
||||
}.unwrap_or_else(|| vec![addr.clone()]);
|
||||
|
||||
// This is a "member removed" message,
|
||||
// we need to notify removed member
|
||||
@@ -2201,14 +2203,6 @@ async fn build_avatar_file(context: &Context, path: &str) -> Result<String> {
|
||||
Ok(encoded_body)
|
||||
}
|
||||
|
||||
fn relay_addrs(public_key: &SignedPublicKey, addr: &str) -> Vec<String> {
|
||||
let mut addrs = addresses_from_public_key(public_key).unwrap_or_default();
|
||||
if !addrs.iter().any(|r| r == addr) {
|
||||
addrs.push(addr.to_string());
|
||||
}
|
||||
addrs
|
||||
}
|
||||
|
||||
fn recipients_contain_addr(recipients: &[(String, String)], addr: &str) -> bool {
|
||||
let addr_lc = addr.to_lowercase();
|
||||
recipients
|
||||
|
||||
Reference in New Issue
Block a user