Skip to content

Commit 9897ef2

Browse files
authored
refactor: Remove error stock strings that are rarely used these days (#7327)
This removes the DC_STR_CANTDECRYPT_MSG_BODY and DC_STR_CANT_DECRYPT_OUTGOING_MSGS stock strings. See deltachat/deltachat-android#3956 (comment) for reasoning.
1 parent 2f34a74 commit 9897ef2

File tree

5 files changed

+7
-36
lines changed

5 files changed

+7
-36
lines changed

deltachat-ffi/deltachat.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6956,11 +6956,6 @@ void dc_event_unref(dc_event_t* event);
69566956
/// Used to build the string returned by dc_get_contact_encrinfo().
69576957
#define DC_STR_ENCR_NONE 28
69586958

6959-
/// "This message was encrypted for another setup."
6960-
///
6961-
/// Used as message text if decryption fails.
6962-
#define DC_STR_CANTDECRYPT_MSG_BODY 29
6963-
69646959
/// "Fingerprints"
69656960
///
69666961
/// Used to build the string returned by dc_get_contact_encrinfo().
@@ -7678,12 +7673,6 @@ void dc_event_unref(dc_event_t* event);
76787673
/// `%1$s` will be replaced by the provider's domain.
76797674
#define DC_STR_INVALID_UNENCRYPTED_MAIL 174
76807675

7681-
/// "⚠️ It seems you are using Delta Chat on multiple devices that cannot decrypt each other's outgoing messages. To fix this, on the older device use \"Settings / Add Second Device\" and follow the instructions."
7682-
///
7683-
/// Added to the device chat if could not decrypt a new outgoing message (i.e. not when fetching
7684-
/// existing messages). But no more than once a day.
7685-
#define DC_STR_CANT_DECRYPT_OUTGOING_MSGS 175
7686-
76877676
/// "You reacted %1$s to '%2$s'"
76887677
///
76897678
/// `%1$s` will be replaced by the reaction, usually an emoji

src/mimeparser.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::sync::SyncItems;
3434
use crate::tools::{
3535
get_filemeta, parse_receive_headers, smeared_time, time, truncate_msg_text, validate_id,
3636
};
37-
use crate::{chatlist_events, location, stock_str, tools};
37+
use crate::{chatlist_events, location, tools};
3838

3939
/// Public key extracted from `Autocrypt-Gossip`
4040
/// header with associated information.
@@ -622,13 +622,12 @@ impl MimeMessage {
622622
parser.parse_mime_recursive(context, mail, false).await?;
623623
}
624624
Err(err) => {
625-
let msg_body = stock_str::cant_decrypt_msg_body(context).await;
626-
let txt = format!("[{msg_body}]");
625+
let txt = "[This message cannot be decrypted.\n\n• It might already help to simply reply to this message and ask the sender to send the message again.\n\n• If you just re-installed Delta Chat then it is best if you re-setup Delta Chat now and choose \"Add as second device\" or import a backup.]";
627626

628627
let part = Part {
629628
typ: Viewtype::Text,
630-
msg_raw: Some(txt.clone()),
631-
msg: txt,
629+
msg_raw: Some(txt.to_string()),
630+
msg: txt.to_string(),
632631
// Don't change the error prefix for now,
633632
// receive_imf.rs:lookup_chat_by_reply() checks it.
634633
error: Some(format!("Decrypting failed: {err:#}")),

src/receive_imf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,8 @@ async fn decide_chat_assignment(
11661166
.await?;
11671167
let now = tools::time();
11681168
let update_config = if last_time.saturating_add(24 * 60 * 60) <= now {
1169-
let mut msg = Message::new_text(stock_str::cant_decrypt_outgoing_msgs(context).await);
1169+
let txt = "⚠️ It seems you are using Delta Chat on multiple devices that cannot decrypt each other's outgoing messages. To fix this, on the older device use \"Settings / Add Second Device\" and follow the instructions.";
1170+
let mut msg = Message::new_text(txt.to_string());
11701171
chat::add_device_msg(context, None, Some(&mut msg))
11711172
.await
11721173
.log_err(context)

src/receive_imf/receive_imf_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3271,7 +3271,7 @@ async fn test_outgoing_undecryptable() -> Result<()> {
32713271
assert!(
32723272
dev_msg
32733273
.text
3274-
.contains(&stock_str::cant_decrypt_outgoing_msgs(alice).await)
3274+
.contains("⚠️ It seems you are using Delta Chat on multiple devices that cannot decrypt each other's outgoing messages. To fix this, on the older device use \"Settings / Add Second Device\" and follow the instructions.")
32753275
);
32763276

32773277
let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_signed.eml");

src/stock_str.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ pub enum StockMessage {
7171
#[strum(props(fallback = "No encryption"))]
7272
EncrNone = 28,
7373

74-
#[strum(props(fallback = "This message was encrypted for another setup."))]
75-
CantDecryptMsgBody = 29,
76-
7774
#[strum(props(fallback = "Fingerprints"))]
7875
FingerPrints = 30,
7976

@@ -392,11 +389,6 @@ pub enum StockMessage {
392389
))]
393390
InvalidUnencryptedMail = 174,
394391

395-
#[strum(props(
396-
fallback = "⚠️ It seems you are using Delta Chat on multiple devices that cannot decrypt each other's outgoing messages. To fix this, on the older device use \"Settings / Add Second Device\" and follow the instructions."
397-
))]
398-
CantDecryptOutgoingMsgs = 175,
399-
400392
#[strum(props(fallback = "You reacted %1$s to \"%2$s\""))]
401393
MsgYouReacted = 176,
402394

@@ -763,16 +755,6 @@ pub(crate) async fn encr_none(context: &Context) -> String {
763755
translated(context, StockMessage::EncrNone).await
764756
}
765757

766-
/// Stock string: `This message was encrypted for another setup.`.
767-
pub(crate) async fn cant_decrypt_msg_body(context: &Context) -> String {
768-
translated(context, StockMessage::CantDecryptMsgBody).await
769-
}
770-
771-
/// Stock string:`Got outgoing message(s) encrypted for another setup...`.
772-
pub(crate) async fn cant_decrypt_outgoing_msgs(context: &Context) -> String {
773-
translated(context, StockMessage::CantDecryptOutgoingMsgs).await
774-
}
775-
776758
/// Stock string: `Fingerprints`.
777759
pub(crate) async fn finger_prints(context: &Context) -> String {
778760
translated(context, StockMessage::FingerPrints).await

0 commit comments

Comments
 (0)