diff --git a/src/constants.rs b/src/constants.rs index b536d040c7..7d377289d9 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -250,6 +250,18 @@ pub(crate) const ASM_BODY: &str = "This is the Autocrypt Setup Message \ /// Period between `sql::housekeeping()` runs. pub(crate) const HOUSEKEEPING_PERIOD: i64 = 24 * 60 * 60; +pub(crate) const BROADCAST_INCOMPATIBILITY_MSG: &str = r#"The up to now "experimental channels feature" is about to become an officially supported one. By that, privacy will be improved, it will become faster, and less traffic will be consumed. + +As we do not guarantee feature-stability for such experiments, this means, that you will need to create the channel again. + +Here is what to do: + • Create a new channel + • Tap on the channel name + • Tap on "QR Invite Code" + • Have all recipients scan the QR code, or send them the link + +If you have any questions, please send an email to delta@merlinux.eu or ask at https://support.delta.chat/."#; + #[cfg(test)] mod tests { use num_traits::FromPrimitive; diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 1ae0e8c93b..3c7a2df638 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -17,7 +17,7 @@ use crate::aheader::{Aheader, EncryptPreference}; use crate::blob::BlobObject; use crate::chat::{self, Chat, PARAM_BROADCAST_SECRET, load_broadcast_secret}; use crate::config::Config; -use crate::constants::ASM_SUBJECT; +use crate::constants::{ASM_SUBJECT, BROADCAST_INCOMPATIBILITY_MSG}; use crate::constants::{Chattype, DC_FROM_HANDSHAKE}; use crate::contact::{Contact, ContactId, Origin}; use crate::context::Context; @@ -1212,17 +1212,7 @@ impl MimeFactory { // because this is an old broadcast channel, // created before we had symmetric encryption, // we show an error message. - let text = r#"The up to now "experimental channels feature" is about to become an officially supported one. By that, privacy will be improved, it will become faster, and less traffic will be consumed. - -As we do not guarantee feature-stability for such experiments, this means, that you will need to create the channel again. - -Here is what to do: - • Create a new channel - • Tap on the channel name - • Tap on "QR Invite Code" - • Have all recipients scan the QR code, or send them the link - -If you have any questions, please send an email to delta@merlinux.eu or ask at https://support.delta.chat/."#; + let text = BROADCAST_INCOMPATIBILITY_MSG; chat::add_info_msg(context, chat.id, text, time()).await?; bail!(text); } diff --git a/src/securejoin.rs b/src/securejoin.rs index eabd2da92c..703bc3d9de 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -4,9 +4,13 @@ use anyhow::{Context as _, Error, Result, bail, ensure}; use deltachat_contact_tools::ContactAddress; use percent_encoding::{AsciiSet, utf8_percent_encode}; -use crate::chat::{self, Chat, ChatId, ChatIdBlocked, get_chat_id_by_grpid}; +use crate::chat::{ + self, Chat, ChatId, ChatIdBlocked, add_info_msg, get_chat_id_by_grpid, load_broadcast_secret, +}; use crate::config::Config; -use crate::constants::{Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT}; +use crate::constants::{ + BROADCAST_INCOMPATIBILITY_MSG, Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT, +}; use crate::contact::mark_contact_id_as_verified; use crate::contact::{Contact, ContactId, Origin}; use crate::context::Context; @@ -98,6 +102,16 @@ pub async fn get_securejoin_qr(context: &Context, chat: Option) -> Resul error!(context, "get_securejoin_qr: {}.", err); bail!(err); } + if chat.typ == Chattype::OutBroadcast { + // If the user created the broadcast before updating Delta Chat, + // then the secret will be missing, and the user needs to recreate the broadcast: + if load_broadcast_secret(context, chat.id).await?.is_none() { + warn!(context, "Not creating securejoin QR for old broadcast"); + let text = BROADCAST_INCOMPATIBILITY_MSG; + add_info_msg(context, chat.id, text, time()).await?; + bail!(text.to_string()); + } + } Some(chat) } None => None,