diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index 4d142018e..ab737ae63 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -2650,6 +2650,11 @@ async fn test_broadcast() -> Result<()> { assert!(msg.was_encrypted()); assert!(!msg.header_exists(HeaderDef::ChatGroupMemberTimestamps)); assert!(!msg.header_exists(HeaderDef::AutocryptGossip)); + + // If we sent a ChatGroupId header, + // older versions of DC would ignore the message + assert!(!msg.header_exists(HeaderDef::ChatGroupId)); + let msg = bob.recv_msg(&sent_msg).await; assert_eq!(msg.get_text(), "ola!"); assert_eq!(msg.subject, "Broadcast channel"); diff --git a/src/mimefactory.rs b/src/mimefactory.rs index f130cd67a..cb0d625c4 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -4,7 +4,7 @@ use std::collections::{BTreeSet, HashSet}; use std::io::Cursor; use std::path::Path; -use anyhow::{Context as _, Result, bail}; +use anyhow::{Context as _, Result, bail, ensure}; use base64::Engine as _; use chrono::TimeZone; use deltachat_contact_tools::sanitize_bidi_characters; @@ -1311,7 +1311,7 @@ impl MimeFactory { )); } - if chat.typ == Chattype::Group || chat.typ == Chattype::OutBroadcast { + if chat.typ == Chattype::Group { // Send group ID unless it is an ad hoc group that has no ID. if !chat.grpid.is_empty() { headers.push(( @@ -1319,7 +1319,9 @@ impl MimeFactory { mail_builder::headers::raw::Raw::new(chat.grpid.clone()).into(), )); } + } + if chat.typ == Chattype::Group || chat.typ == Chattype::OutBroadcast { headers.push(( "Chat-Group-Name", mail_builder::headers::text::Text::new(chat.name.to_string()).into(), @@ -1333,6 +1335,7 @@ impl MimeFactory { match command { SystemMessage::MemberRemovedFromGroup => { + ensure!(chat.typ != Chattype::OutBroadcast); let email_to_remove = msg.param.get(Param::Arg).unwrap_or_default(); if email_to_remove @@ -1356,6 +1359,7 @@ impl MimeFactory { } } SystemMessage::MemberAddedToGroup => { + ensure!(chat.typ != Chattype::OutBroadcast); // TODO: lookup the contact by ID rather than email address. // We are adding key-contacts, the cannot be looked up by address. let email_to_add = msg.param.get(Param::Arg).unwrap_or_default();