feat: Move unverified messages which don't introduce a new Autocrypt key from protected 1:1 chats to ad-hoc groups

This prevents protected 1:1 chats from breaking by messages sent by classical MUAs.

TODO: Some `tests::verified_chats` tests are failing, but as far as i see from the log, the tests
must be fixed, the change itself looks ok. Not fixing the tests now, not sure we will merge this as
it's just POC.
This commit is contained in:
iequidoo
2023-10-01 00:06:44 -03:00
parent 0ea1e93567
commit 67771735a9

View File

@@ -769,12 +769,12 @@ async fn add_parts(
new_protection =
match decryption_info.autocrypt_header.as_ref().filter(|ah| {
Some(&ah.public_key.fingerprint())
== decryption_info
!= decryption_info
.peerstate
.as_ref()
.and_then(|p| p.verified_key_fingerprint.as_ref())
}) {
Some(_) => {
None => {
if let Some(new_chat_id) = create_adhoc_group(
context,
mime_parser,
@@ -801,7 +801,7 @@ async fn add_parts(
}
chat.protected
}
None => ProtectionStatus::ProtectionBroken,
Some(_) => ProtectionStatus::ProtectionBroken,
};
}
if chat.protected != new_protection {