mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
feat: Do not copy Auto-Submitted header into outer part
Before, copying Auto-Submitted to the outer headers was needed for moving such messages, e.g. multi-device sync messages, to the DeltaChat folder. Now all encrypted messages are moved.
This commit is contained in:
@@ -1062,7 +1062,7 @@ impl MimeFactory {
|
|||||||
mail_builder::headers::raw::Raw::new("[...]").into(),
|
mail_builder::headers::raw::Raw::new("[...]").into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
"in-reply-to" | "references" | "auto-submitted" | "autocrypt-setup-message" => {
|
"in-reply-to" | "references" | "autocrypt-setup-message" => {
|
||||||
unprotected_headers.push(header.clone());
|
unprotected_headers.push(header.clone());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
bob.set_config(Config::Displayname, Some("Bob Examplenet"))
|
bob.set_config(Config::Displayname, Some("Bob Examplenet"))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let alice_auto_submitted_hdr;
|
let alice_auto_submitted_val;
|
||||||
match case {
|
match case {
|
||||||
SetupContactCase::AliceIsBot => {
|
SetupContactCase::AliceIsBot => {
|
||||||
alice.set_config_bool(Config::Bot, true).await.unwrap();
|
alice.set_config_bool(Config::Bot, true).await.unwrap();
|
||||||
alice_auto_submitted_hdr = "Auto-Submitted: auto-generated";
|
alice_auto_submitted_val = "auto-generated";
|
||||||
}
|
}
|
||||||
_ => alice_auto_submitted_hdr = "Auto-Submitted: auto-replied",
|
_ => alice_auto_submitted_val = "auto-replied",
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -121,7 +121,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let sent = alice.pop_sent_msg().await;
|
let sent = alice.pop_sent_msg().await;
|
||||||
assert!(sent.payload.contains(alice_auto_submitted_hdr));
|
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||||
assert!(!sent.payload.contains("Alice Exampleorg"));
|
assert!(!sent.payload.contains("Alice Exampleorg"));
|
||||||
let msg = bob.parse_msg(&sent).await;
|
let msg = bob.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
@@ -129,6 +129,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||||
"vc-auth-required"
|
"vc-auth-required"
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||||
|
alice_auto_submitted_val
|
||||||
|
);
|
||||||
|
|
||||||
let bob_chat = bob.get_chat(&alice).await;
|
let bob_chat = bob.get_chat(&alice).await;
|
||||||
assert_eq!(bob_chat.can_send(&bob).await.unwrap(), true);
|
assert_eq!(bob_chat.can_send(&bob).await.unwrap(), true);
|
||||||
@@ -157,7 +161,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
|
|
||||||
// Check Bob sent the right message.
|
// Check Bob sent the right message.
|
||||||
let sent = bob.pop_sent_msg().await;
|
let sent = bob.pop_sent_msg().await;
|
||||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||||
assert!(!sent.payload.contains("Bob Examplenet"));
|
assert!(!sent.payload.contains("Bob Examplenet"));
|
||||||
let mut msg = alice.parse_msg(&sent).await;
|
let mut msg = alice.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
@@ -171,6 +175,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
||||||
bob_fp
|
bob_fp
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||||
|
"auto-replied"
|
||||||
|
);
|
||||||
|
|
||||||
if case == SetupContactCase::WrongAliceGossip {
|
if case == SetupContactCase::WrongAliceGossip {
|
||||||
let wrong_pubkey = GossipedKey {
|
let wrong_pubkey = GossipedKey {
|
||||||
@@ -248,7 +256,7 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
|
|
||||||
// Check Alice sent the right message to Bob.
|
// Check Alice sent the right message to Bob.
|
||||||
let sent = alice.pop_sent_msg().await;
|
let sent = alice.pop_sent_msg().await;
|
||||||
assert!(sent.payload.contains(alice_auto_submitted_hdr));
|
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||||
assert!(!sent.payload.contains("Alice Exampleorg"));
|
assert!(!sent.payload.contains("Alice Exampleorg"));
|
||||||
let msg = bob.parse_msg(&sent).await;
|
let msg = bob.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
@@ -256,6 +264,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) {
|
|||||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||||
"vc-contact-confirm"
|
"vc-contact-confirm"
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||||
|
alice_auto_submitted_val
|
||||||
|
);
|
||||||
|
|
||||||
// Bob has verified Alice already.
|
// Bob has verified Alice already.
|
||||||
//
|
//
|
||||||
@@ -465,13 +477,17 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
alice.recv_msg_trash(&sent).await;
|
alice.recv_msg_trash(&sent).await;
|
||||||
|
|
||||||
let sent = alice.pop_sent_msg().await;
|
let sent = alice.pop_sent_msg().await;
|
||||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||||
let msg = bob.parse_msg(&sent).await;
|
let msg = bob.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||||
"vg-auth-required"
|
"vg-auth-required"
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||||
|
"auto-replied"
|
||||||
|
);
|
||||||
|
|
||||||
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
|
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
|
||||||
bob.recv_msg_trash(&sent).await;
|
bob.recv_msg_trash(&sent).await;
|
||||||
@@ -503,7 +519,7 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check Bob sent the right handshake message.
|
// Check Bob sent the right handshake message.
|
||||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
assert!(!sent.payload.contains("Auto-Submitted:"));
|
||||||
let msg = alice.parse_msg(&sent).await;
|
let msg = alice.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -516,6 +532,10 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
msg.get_header(HeaderDef::SecureJoinFingerprint).unwrap(),
|
||||||
bob_fp
|
bob_fp
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
msg.get_header(HeaderDef::AutoSubmitted).unwrap(),
|
||||||
|
"auto-replied"
|
||||||
|
);
|
||||||
|
|
||||||
// Alice should not yet have Bob verified
|
// Alice should not yet have Bob verified
|
||||||
let contact_bob = alice.add_or_lookup_contact_no_key(&bob).await;
|
let contact_bob = alice.add_or_lookup_contact_no_key(&bob).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user