Skip to content

Commit

Permalink
feat: do not reveal sender's language in read receipts (#5802)
Browse files Browse the repository at this point in the history
while adapting strings for the recent change about read receipts,
#5712 , it turns
out in discussions eg. at
deltachat/deltachat-android#3179 that
untranslated english for the read receipts seem to be sufficient or even
better:

- do not reveal the sender's language
- unexpected languages are confusing - even if you chat in english, you
may get Chinese read receipts
- many clients do not show the text anyways, iirc, eg. Outlook display
the read receipts in context, and Delta Chat of course as well
- afaik, we're leaving comparable `multipart/report` untranslated as
well (sync, but also webxdc updates are practically english only)
- less code, fewer translations needed :)
  • Loading branch information
r10s authored Jul 26, 2024
1 parent c4efe59 commit 03523ab
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 33 deletions.
9 changes: 3 additions & 6 deletions deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -6650,14 +6650,16 @@ void dc_event_unref(dc_event_t* event);
/// "Message opened"
///
/// Used in subjects of outgoing read receipts.
///
/// @deprecated Deprecated 2024-07-26
#define DC_STR_READRCPT 31

/// "The message '%1$s' you sent was displayed on the screen of the recipient."
///
/// Used as message text of outgoing read receipts.
/// - %1$s will be replaced by the subject of the displayed message
///
/// @deprecated Deprecated 2024-06-23, use DC_STR_READRCPT_MAILBODY2 instead.
/// @deprecated Deprecated 2024-06-23
#define DC_STR_READRCPT_MAILBODY 32

/// @deprecated Deprecated, this string is no longer needed.
Expand Down Expand Up @@ -7376,11 +7378,6 @@ void dc_event_unref(dc_event_t* event);
/// Used as info message.
#define DC_STR_SECUREJOIN_WAIT_TIMEOUT 191

/// "The message is a receipt notification."
///
/// Used as message text of outgoing read receipts.
#define DC_STR_READRCPT_MAILBODY2 192

/// "Contact". Deprecated, currently unused.
#define DC_STR_CONTACT 200

Expand Down
1 change: 0 additions & 1 deletion node/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ module.exports = {
DC_STR_REACTED_BY: 177,
DC_STR_READRCPT: 31,
DC_STR_READRCPT_MAILBODY: 32,
DC_STR_READRCPT_MAILBODY2: 192,
DC_STR_REMOVE_MEMBER_BY_OTHER: 131,
DC_STR_REMOVE_MEMBER_BY_YOU: 130,
DC_STR_REPLY_NOUN: 90,
Expand Down
1 change: 0 additions & 1 deletion node/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ export enum C {
DC_STR_REACTED_BY = 177,
DC_STR_READRCPT = 31,
DC_STR_READRCPT_MAILBODY = 32,
DC_STR_READRCPT_MAILBODY2 = 192,
DC_STR_REMOVE_MEMBER_BY_OTHER = 131,
DC_STR_REMOVE_MEMBER_BY_YOU = 130,
DC_STR_REPLY_NOUN = 90,
Expand Down
17 changes: 8 additions & 9 deletions src/mimefactory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ impl MimeFactory {
};
stock_str::subject_for_new_contact(context, self_name).await
}
Loaded::Mdn { .. } => stock_str::read_rcpt(context).await,
Loaded::Mdn { .. } => "Receipt Notification".to_string(), // untranslated to no reveal sender's language
};

Ok(subject)
Expand Down Expand Up @@ -672,7 +672,7 @@ impl MimeFactory {
})
}
}
Loaded::Mdn { .. } => self.render_mdn(context).await?,
Loaded::Mdn { .. } => self.render_mdn()?,
};

let get_content_type_directives_header = || {
Expand Down Expand Up @@ -1400,7 +1400,7 @@ impl MimeFactory {
}

/// Render an MDN
async fn render_mdn(&mut self, context: &Context) -> Result<PartBuilder> {
fn render_mdn(&mut self) -> Result<PartBuilder> {
// RFC 6522, this also requires the `report-type` parameter which is equal
// to the MIME subtype of the second body part of the multipart/report
//
Expand All @@ -1426,16 +1426,15 @@ impl MimeFactory {
"multipart/report; report-type=disposition-notification".to_string(),
));

// first body part: always human-readable, always REQUIRED by RFC 6522
let message_text = format!(
"{}\r\n",
format_flowed(&stock_str::read_rcpt_mail_body(context).await)
);
// first body part: always human-readable, always REQUIRED by RFC 6522.
// untranslated to no reveal sender's language.
// moreover, translations in unknown languages are confusing, and clients may not display them at all
let text_part = PartBuilder::new().header((
"Content-Type".to_string(),
"text/plain; charset=utf-8; format=flowed; delsp=no".to_string(),
));
let text_part = self.add_message_text(text_part, message_text);
let text_part =
self.add_message_text(text_part, "This is a receipt notification.\r\n".to_string());
message = message.child(text_part.build());

// second body part: machine-readable, always REQUIRED by RFC 6522
Expand Down
16 changes: 0 additions & 16 deletions src/stock_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ pub enum StockMessage {
#[strum(props(fallback = "Fingerprints"))]
FingerPrints = 30,

#[strum(props(fallback = "Return receipt"))]
ReadRcpt = 31,

#[strum(props(fallback = "End-to-end encryption preferred"))]
E2ePreferred = 34,

Expand Down Expand Up @@ -440,9 +437,6 @@ pub enum StockMessage {
fallback = "Could not yet establish guaranteed end-to-end encryption, but you may already send a message."
))]
SecurejoinWaitTimeout = 191,

#[strum(props(fallback = "This message is a receipt notification."))]
ReadRcptMailBody = 192,
}

impl StockMessage {
Expand Down Expand Up @@ -795,16 +789,6 @@ pub(crate) async fn finger_prints(context: &Context) -> String {
translated(context, StockMessage::FingerPrints).await
}

/// Stock string: `Return receipt`.
pub(crate) async fn read_rcpt(context: &Context) -> String {
translated(context, StockMessage::ReadRcpt).await
}

/// Stock string: `This message is a receipt notification.`.
pub(crate) async fn read_rcpt_mail_body(context: &Context) -> String {
translated(context, StockMessage::ReadRcptMailBody).await
}

/// Stock string: `Group image deleted.`.
pub(crate) async fn msg_grp_img_deleted(context: &Context, by_contact: ContactId) -> String {
if by_contact == ContactId::SELF {
Expand Down

0 comments on commit 03523ab

Please sign in to comment.