Skip to content

Commit 31fabb2

Browse files
committed
feat: Don't send Chat-Group-Name* headers for InBroadcast-s
Broadcast subscribers can't change the chat name, so sending the "Chat-Group-Name{,-Timestamp}" headers looks unnecessary. That could be useful for other subscriber's devices, but having only the chat name isn't enough anyway, at least knowing the secret is necessary which is sent by the broadcast owner.
1 parent 66df0d2 commit 31fabb2

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

src/chat/chat_tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,6 +2805,15 @@ async fn test_broadcast_members_cant_see_each_other() -> Result<()> {
28052805
"alice@example.org charlie@example.net"
28062806
);
28072807

2808+
// Check additionally that subscribers don't send "Chat-Group-Name*" headers.
2809+
let parsed = alice.parse_msg(&request_with_auth).await;
2810+
assert!(parsed.get_header(HeaderDef::ChatGroupName).is_none());
2811+
assert!(
2812+
parsed
2813+
.get_header(HeaderDef::ChatGroupNameTimestamp)
2814+
.is_none()
2815+
);
2816+
28082817
alice.recv_msg_trash(&request_with_auth).await;
28092818
}
28102819

src/mimefactory.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,7 @@ impl MimeFactory {
13941394
}
13951395
}
13961396

1397-
if chat.typ == Chattype::Group
1398-
|| chat.typ == Chattype::OutBroadcast
1399-
|| chat.typ == Chattype::InBroadcast
1400-
{
1397+
if chat.typ == Chattype::Group || chat.typ == Chattype::OutBroadcast {
14011398
headers.push((
14021399
"Chat-Group-Name",
14031400
mail_builder::headers::text::Text::new(chat.name.to_string()).into(),
@@ -1408,7 +1405,11 @@ impl MimeFactory {
14081405
mail_builder::headers::text::Text::new(ts.to_string()).into(),
14091406
));
14101407
}
1411-
1408+
}
1409+
if chat.typ == Chattype::Group
1410+
|| chat.typ == Chattype::OutBroadcast
1411+
|| chat.typ == Chattype::InBroadcast
1412+
{
14121413
match command {
14131414
SystemMessage::MemberRemovedFromGroup => {
14141415
let email_to_remove = msg.param.get(Param::Arg).unwrap_or_default();

0 commit comments

Comments
 (0)