mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 20:06:30 +03:00
feat: Allow sending unencrypted for chatmail if SignUnencrypted is set
If a chatmail user somehow can send unencrypted, setting `SignUnencrypted` is a simplest workaround, it has no meaning for chatmail anyway. Setting `IsChatmail` to 0 has more side effects.
This commit is contained in:
@@ -48,12 +48,13 @@ impl EncryptHelper {
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
peerstates: &[(Option<Peerstate>, String)],
|
peerstates: &[(Option<Peerstate>, String)],
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
let is_chatmail = context.is_chatmail().await?;
|
// For chatmail we ignore the encryption preference,
|
||||||
|
// because we can either send encrypted or not at all.
|
||||||
|
let encrypt_if_possible = context.is_chatmail().await?
|
||||||
|
&& !context.get_config_bool(Config::SignUnencrypted).await?;
|
||||||
for (peerstate, _addr) in peerstates {
|
for (peerstate, _addr) in peerstates {
|
||||||
if let Some(peerstate) = peerstate {
|
if let Some(peerstate) = peerstate {
|
||||||
// For chatmail we ignore the encryption preference,
|
if encrypt_if_possible || peerstate.prefer_encrypt != EncryptPreference::Reset {
|
||||||
// because we can either send encrypted or not at all.
|
|
||||||
if is_chatmail || peerstate.prefer_encrypt != EncryptPreference::Reset {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user