Skip to content

Decide on chat assignment before contact lookup #6868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 84 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ee53a54
Add ChatAssignment enum
link2xt May 16, 2025
0c35aa3
No need to check for 1 recpient once we decided on 1:1
link2xt May 17, 2025
3acfbe6
pass chat_assignment to add_parts
link2xt May 17, 2025
fd1eb7d
WIP: use chat assignment in add_parts
link2xt May 17, 2025
546e0ea
some ChatAssignment for outgoing messages
link2xt May 17, 2025
6a5df61
move parent message filtering out of add_parts
link2xt May 20, 2025
0d3e6f0
trash MDNs early
link2xt May 20, 2025
02bdff1
never allow chat creation by MDN
link2xt May 20, 2025
7afcd7d
remove outdated comment
link2xt May 20, 2025
48e840d
trash DSN early
link2xt May 20, 2025
200248f
trash more messages early
link2xt May 20, 2025
fb78402
trash webxdc status updates early
link2xt May 20, 2025
dfe9d7e
trash outgoing undecryptable messages early
link2xt May 20, 2025
1073b0b
doc comment
link2xt May 20, 2025
b8fe657
ChatAssignment::Trash
link2xt May 20, 2025
75ce32a
rustfmt
link2xt May 21, 2025
eda5f56
simplify allow_creation
link2xt May 21, 2025
15ba0a1
move trash chat assignment
link2xt May 21, 2025
91ae9d8
don't disallow trash chat creation
link2xt May 21, 2025
cc8bc70
clippy
link2xt May 21, 2025
d5b70ca
unused field
link2xt May 21, 2025
2cd6d3f
clippy
link2xt May 21, 2025
2dd96f8
is_probably_private_reply not called for messages with group ID
link2xt May 22, 2025
9cb5e09
encrypt test_send_reaction_multidevice
link2xt May 22, 2025
e9f198d
less contact IDs
link2xt May 22, 2025
c3db92b
simplify lookup_chat_by_reply
link2xt May 22, 2025
7dc1754
remove special case for alias support
link2xt May 22, 2025
aef2029
pass non-optional message into lookup_chat_by_reply
link2xt May 23, 2025
324204b
remove some dead code
link2xt May 23, 2025
44f0045
lookup_chat_by_reply refactor
link2xt May 23, 2025
62ccdb7
factoring out chat lookup by references
link2xt May 23, 2025
e679932
not too many arguments
link2xt May 23, 2025
da60ab6
ChatAssignment::ExistingChat
link2xt May 23, 2025
9a7078e
derive debug for chat assignment
link2xt May 24, 2025
99a2185
no non-members in 1:1 chats
link2xt May 24, 2025
85edc8d
trash classic emails early
link2xt May 24, 2025
792cf23
remove always-true check
link2xt May 24, 2025
98fcd09
process ChatAssignment::MailingList
link2xt May 24, 2025
e70b5ce
no wildcard match on ChatAssignment
link2xt May 24, 2025
e3f2946
unblock any chats for outgoing messages
link2xt May 24, 2025
66a3dfc
group chat assignment
link2xt May 24, 2025
279640b
refactoring
link2xt May 24, 2025
9ba0ad0
do not unassign messages from chats
link2xt May 24, 2025
205c8a2
group chat assignment
link2xt May 24, 2025
6f60473
assign chat_id_blocked
link2xt May 24, 2025
588b85b
move chat assignment closer to the beginnig for add_parts
link2xt May 24, 2025
329c36e
group group_changes
link2xt May 24, 2025
950f9a3
group chat assignment more
link2xt May 24, 2025
d49e8ba
direct check for has_chat_version
link2xt May 24, 2025
6fb0596
almost immutable chat_id
link2xt May 24, 2025
081204c
immutable chat_id
link2xt May 24, 2025
9bf73ad
immutable needs_delete_job
link2xt May 24, 2025
d5d1d39
more stuff after chat assignment
link2xt May 24, 2025
d27e850
prevent_rename after chat assignment
link2xt May 24, 2025
e717183
remove restore_protection
link2xt May 24, 2025
fba5ca3
factor out do_chat_assignment
link2xt May 24, 2025
552d86d
clippy
link2xt May 24, 2025
e6a79fb
call do_chat_assignment from receive_imf
link2xt May 24, 2025
b31b935
clippy
link2xt May 24, 2025
3d1d1e4
log chat assignment
link2xt May 24, 2025
5d456f0
lookup pgp contacts for existing PGP-chat
link2xt May 24, 2025
65bd25b
test fixup
link2xt May 24, 2025
6525a24
remove test_protected_group_reply_from_mua
link2xt May 24, 2025
e0b84b7
encrypt test_subject_in_group
link2xt May 24, 2025
b3adddc
Allow to assign partial downloads to encrypted chats
link2xt May 25, 2025
827e39c
do not lookup adhoc group for 1:1 chat
link2xt May 26, 2025
430cfe3
cleanup
link2xt May 26, 2025
881f8ff
do not ignore unencrypted Chat-Group-ID
link2xt May 26, 2025
b3ead8c
clippy
link2xt May 26, 2025
839630f
merge pgp-contacts into chat-assignment
link2xt May 29, 2025
7ddbc19
Update src/receive_imf.rs
link2xt May 29, 2025
780afc4
Update src/receive_imf.rs
link2xt May 29, 2025
d72fcb9
Update src/receive_imf.rs
link2xt May 29, 2025
6deff15
document ExistingChat
link2xt May 30, 2025
eef4c63
Test assigning unencrypted messages with Chat-Group-ID to adhoc groups
link2xt May 30, 2025
f449f08
remove comment about OutDelivered
link2xt May 30, 2025
0455463
Update src/receive_imf.rs
link2xt May 30, 2025
10020f7
adjust GroupChat comment
link2xt May 30, 2025
4688b0b
Update src/receive_imf.rs
link2xt May 30, 2025
5bbe565
extract decide_chat_assignment
link2xt May 30, 2025
ba267d4
clippy
link2xt May 30, 2025
239174f
Update src/receive_imf.rs
link2xt May 30, 2025
fd225ca
Update src/receive_imf.rs
link2xt May 30, 2025
67add91
lint/fmt
link2xt May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions src/mimefactory/mimefactory_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,39 +339,31 @@ async fn test_subject_in_group() -> Result<()> {
}

// 6. Test that in a group, replies also take the quoted message's subject, while non-replies use the group title as subject
let t = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let group_id = chat::create_group_chat(&t, chat::ProtectionStatus::Unprotected, "groupname") // TODO encodings, ä
let mut tcm = TestContextManager::new();
let t = tcm.alice().await;
let bob = tcm.bob().await;
let group_id = chat::create_group_chat(&t, chat::ProtectionStatus::Unprotected, "groupname")
.await
.unwrap();
let bob_contact_id = t.add_or_lookup_contact_id(&bob).await;
chat::add_contact_to_chat(&t, group_id, bob_contact_id).await?;

let sent_message = t.send_text(group_id, "Hello!").await;
let bob_received_message = bob.recv_msg(&sent_message).await;
let bob_group_id = bob_received_message.chat_id;
bob_group_id.accept(&bob).await.unwrap();
assert_eq!(get_subject(&t, sent_message).await?, "groupname");

let subject = send_msg_get_subject(&t, group_id, None).await?;
assert_eq!(subject, "groupname");
assert_eq!(subject, "Re: groupname");

let subject = send_msg_get_subject(&t, group_id, None).await?;
assert_eq!(subject, "Re: groupname");

receive_imf(
&t,
format!(
"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\
From: [email protected]\n\
To: [email protected]\n\
Subject: Different subject\n\
In-Reply-To: {}\n\
Message-ID: <[email protected]>\n\
Date: Sun, 22 Mar 2020 22:37:56 +0000\n\
\n\
hello\n",
t.get_last_msg().await.rfc724_mid
)
.as_bytes(),
false,
)
.await?;
let message_from_bob = t.get_last_msg().await;
let mut msg = Message::new(Viewtype::Text);
msg.set_subject("Different subject".to_string());
let bob_sent_msg = bob.send_msg(bob_group_id, &mut msg).await;
let message_from_bob = t.recv_msg(&bob_sent_msg).await;

let subject = send_msg_get_subject(&t, group_id, None).await?;
assert_eq!(subject, "Re: groupname");
Expand Down
10 changes: 0 additions & 10 deletions src/mimeparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,16 +1526,6 @@ impl MimeMessage {
remove_header(headers, "chat-verified", removed);
remove_header(headers, "autocrypt-gossip", removed);

// Chat-Group-ID can only appear in encrypted messages
// since PGP-contact migration.
//
// Unencrypted ad hoc groups do not have group IDs.
//
// If we receive a Chat-Group-ID header in unencrypted message,
// it is likely sent by old version in opportunistically
// encrypted group that dropped to unencrypted.
remove_header(headers, "chat-group-id", removed);

// Secure-Join is secured unless it is an initial "vc-request"/"vg-request".
if let Some(secure_join) = remove_header(headers, "secure-join", removed) {
if secure_join == "vc-request" || secure_join == "vg-request" {
Expand Down
9 changes: 5 additions & 4 deletions src/reaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,10 +980,11 @@ Here's my footer -- [email protected]"

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_send_reaction_multidevice() -> Result<()> {
let alice0 = TestContext::new_alice().await;
let alice1 = TestContext::new_alice().await;
let bob_id = Contact::create(&alice0, "", "[email protected]").await?;
let chat_id = ChatId::create_for_contact(&alice0, bob_id).await?;
let mut tcm = TestContextManager::new();
let alice0 = tcm.alice().await;
let alice1 = tcm.alice().await;
let bob = tcm.bob().await;
let chat_id = alice0.create_chat(&bob).await.id;

let alice0_msg_id = send_text_msg(&alice0, chat_id, "foo".to_string()).await?;
let alice1_msg = alice1.recv_msg(&alice0.pop_sent_msg().await).await;
Expand Down
Loading