File tree Expand file tree Collapse file tree 3 files changed +38
-12
lines changed Expand file tree Collapse file tree 3 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -1526,16 +1526,6 @@ impl MimeMessage {
1526
1526
remove_header ( headers, "chat-verified" , removed) ;
1527
1527
remove_header ( headers, "autocrypt-gossip" , removed) ;
1528
1528
1529
- // Chat-Group-ID can only appear in encrypted messages
1530
- // since PGP-contact migration.
1531
- //
1532
- // However, we do not remove `Chat-Group-ID` here.
1533
- // If we receive an unencrypted `Chat-Group-ID`
1534
- // from an older version which allowed
1535
- // unencrypted groups, we still want to assign
1536
- // a message to a group, but it will be an ad hoc group
1537
- // without a group ID.
1538
-
1539
1529
// Secure-Join is secured unless it is an initial "vc-request"/"vg-request".
1540
1530
if let Some ( secure_join) = remove_header ( headers, "secure-join" , removed) {
1541
1531
if secure_join == "vc-request" || secure_join == "vg-request" {
Original file line number Diff line number Diff line change @@ -1473,7 +1473,7 @@ async fn do_chat_assignment(
1473
1473
) ;
1474
1474
}
1475
1475
}
1476
- ChatAssignment :: AdHocGroup | ChatAssignment :: OneOneChat => {
1476
+ ChatAssignment :: AdHocGroup => {
1477
1477
if let Some ( ( new_chat_id, new_chat_id_blocked) ) = lookup_or_create_adhoc_group (
1478
1478
context,
1479
1479
mime_parser,
@@ -1489,6 +1489,7 @@ async fn do_chat_assignment(
1489
1489
chat_id_blocked = new_chat_id_blocked;
1490
1490
}
1491
1491
}
1492
+ ChatAssignment :: OneOneChat => { }
1492
1493
}
1493
1494
1494
1495
if !to_ids. is_empty ( ) {
@@ -3323,7 +3324,8 @@ async fn create_adhoc_group(
3323
3324
) ;
3324
3325
return Ok ( Some ( ( DC_CHAT_ID_TRASH , Blocked :: Not ) ) ) ;
3325
3326
}
3326
- if member_ids. len ( ) < 3 {
3327
+ if member_ids. len ( ) < 2 {
3328
+ info ! ( context, "Not creating ad hoc group with less than 2 members." ) ;
3327
3329
return Ok ( None ) ;
3328
3330
}
3329
3331
Original file line number Diff line number Diff line change @@ -5115,3 +5115,37 @@ async fn test_no_email_contact_added_into_group() -> Result<()> {
5115
5115
5116
5116
Ok ( ( ) )
5117
5117
}
5118
+
5119
+ /// Tests that message is assigned to an ad hoc group
5120
+ /// if the message has a `Chat-Group-ID` even
5121
+ /// if there are only two members in a group.
5122
+ ///
5123
+ /// Since PGP-contacts introduction all groups are encrypted,
5124
+ /// but old versions running on other devices might still
5125
+ /// create unencrypted groups.
5126
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
5127
+ async fn test_outgoing_plaintext_two_member_group ( ) -> Result < ( ) > {
5128
+ let mut tcm = TestContextManager :: new ( ) ;
5129
+ let alice = & tcm. alice ( ) . await ;
5130
+
5131
+ let msg = receive_imf (
5132
+ alice,
5133
+ b"From: alice@example.org\n \
5134
+ To: bob@example.net\n \
5135
+ Subject: foo\n \
5136
+ Message-ID: <something@example.com>\n \
5137
+ Chat-Version: 1.0\n \
5138
+ Chat-Group-ID: 8ud29aridt29arid\n \
5139
+ Date: Sun, 22 Mar 2020 22:37:57 +0000\n \
5140
+ \n \
5141
+ Hello\n ",
5142
+ false ,
5143
+ )
5144
+ . await ?
5145
+ . unwrap ( ) ;
5146
+
5147
+ let chat = Chat :: load_from_db ( alice, msg. chat_id ) . await ?;
5148
+ assert_eq ! ( chat. typ, Chattype :: Group ) ;
5149
+
5150
+ Ok ( ( ) )
5151
+ }
You can’t perform that action at this time.
0 commit comments