mirror of
https://github.com/chatmail/core.git
synced 2026-09-22 04:58:47 +03:00
fix: return no relay address for key-contacts without an address
`relay_addrs()` fell back to the contact address even when it is empty, which happens for key-contacts created from a sync message or for the self-contact, putting an empty string into the SMTP recipient list.
This commit is contained in:
13
src/pgp.rs
13
src/pgp.rs
@@ -474,7 +474,18 @@ pub(crate) fn addresses_from_public_key(public_key: &SignedPublicKey) -> Option<
|
||||
/// Returns the addresses to reach the owner of `public_key`,
|
||||
/// falling back to `addr` if the key carries no relay list.
|
||||
pub(crate) fn relay_addrs(public_key: &SignedPublicKey, addr: &str) -> Vec<String> {
|
||||
addresses_from_public_key(public_key).unwrap_or_else(|| vec![addr.to_string()])
|
||||
addresses_from_public_key(public_key).unwrap_or_else(|| {
|
||||
if addr.is_empty() {
|
||||
vec![]
|
||||
} else {
|
||||
vec![addr.to_string()]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns true if the key can be encrypted to, i.e. has an encryption subkey.
|
||||
pub(crate) fn pubkey_can_encrypt(public_key: &SignedPublicKey) -> bool {
|
||||
select_pk_for_encryption(public_key).is_some()
|
||||
}
|
||||
|
||||
/// Returns true if public key advertises SEIPDv2 feature.
|
||||
|
||||
Reference in New Issue
Block a user