Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -7756,7 +7756,17 @@ void dc_event_unref(dc_event_t* event);
/// Subtitle for channel join qrcode svg image generated by the core.
///
/// `%1$s` will be replaced with the channel name.
#define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 201
#define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 201

/// "You joined the channel."
#define DC_STR_MSG_YOU_JOINED_CHANNEL 202

/// "%1$s invited you to join this channel. Waiting for the device of %2$s to reply…"
///
/// Added as an info-message directly after scanning a QR code for joining a broadcast channel.
///
/// `%1$s` and `%2$s` will both be replaced by the name of the inviter.
#define DC_STR_SECURE_JOIN_CHANNEL_STARTED 203

/// "Proxy Enabled"
///
Expand Down
2 changes: 1 addition & 1 deletion deltachat-rpc-client/tests/test_securejoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def check_account(ac, contact, inviter_side, please_wait_info_msg=False):

if please_wait_info_msg:
first_msg = chat_msgs.pop(0).get_snapshot()
assert first_msg.text == "Establishing connection, please wait…"
assert "invited you to join this channel" in first_msg.text
assert first_msg.is_info

member_added_msg = chat_msgs.pop(0).get_snapshot()
Expand Down
2 changes: 1 addition & 1 deletion deltachat-rpc-client/tests/test_something.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def check_account(ac, contact, inviter_side, please_wait_info_msg=False):

if please_wait_info_msg:
first_msg = chat_msgs.pop(0).get_snapshot()
assert first_msg.text == "Establishing connection, please wait…"
assert "invited you to join this channel" in first_msg.text
assert first_msg.is_info

member_added_msg = chat_msgs.pop(0).get_snapshot()
Expand Down
5 changes: 2 additions & 3 deletions src/securejoin/bob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
}

// If we were not in the broadcast channel before, show a 'please wait' info message.
// Since we don't have any specific stock string for this,
// use the generic `Establishing connection, please wait…`
if !is_contact_in_chat(context, joining_chat_id, ContactId::SELF).await? {
let msg = stock_str::securejoin_wait(context).await;
let msg =
stock_str::secure_join_broadcast_started(context, invite.contact_id()).await;
chat::add_info_msg(context, joining_chat_id, &msg).await?;
}
Ok(joining_chat_id)
Expand Down
19 changes: 19 additions & 0 deletions src/stock_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ https://delta.chat/donate"))]
#[strum(props(fallback = "You joined the channel."))]
MsgYouJoinedBroadcast = 202,

#[strum(props(fallback = "%1$s invited you to join this channel.\n\n\
Waiting for the device of %2$s to reply…"))]
SecureJoinBroadcastStarted = 203,

#[strum(props(
fallback = "The attachment contains anonymous usage statistics, which helps us improve Delta Chat. Thank you!"
))]
Expand Down Expand Up @@ -737,6 +741,21 @@ pub(crate) async fn msg_you_joined_broadcast(context: &Context) -> String {
translated(context, StockMessage::MsgYouJoinedBroadcast).await
}

/// Stock string: `%1$s invited you to join this channel. Waiting for the device of %2$s to reply…`.
pub(crate) async fn secure_join_broadcast_started(
context: &Context,
inviter_contact_id: ContactId,
) -> String {
if let Ok(contact) = Contact::get_by_id(context, inviter_contact_id).await {
translated(context, StockMessage::SecureJoinBroadcastStarted)
.await
.replace1(contact.get_display_name())
.replace2(contact.get_display_name())
} else {
format!("secure_join_started: unknown contact {inviter_contact_id}")
}
}

/// Stock string: `You reacted %1$s to "%2$s"` or `%1$s reacted %2$s to "%3$s"`.
pub(crate) async fn msg_reacted(
context: &Context,
Expand Down
4 changes: 3 additions & 1 deletion test-data/golden/test_broadcast_joining_golden_bob
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
InBroadcast#Chat#2002: My Channel [2 member(s)] Icon: e9b6c7a78aa2e4f415644f55a553e73.png
--------------------------------------------------------------------------------
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
Msg#2004: info (Contact#Contact#Info): Establishing connection, please wait… [NOTICED][INFO]
Msg#2004: info (Contact#Contact#Info): Alice invited you to join this channel.

Waiting for the device of Alice to reply… [NOTICED][INFO]
Msg#2007🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
--------------------------------------------------------------------------------
4 changes: 3 additions & 1 deletion test-data/golden/test_sync_broadcast_bob
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
InBroadcast#Chat#2002: Channel [1 member(s)]
--------------------------------------------------------------------------------
Msg#2003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
Msg#2004: info (Contact#Contact#Info): Establishing connection, please wait… [NOTICED][INFO]
Msg#2004: info (Contact#Contact#Info): alice@example.org invited you to join this channel.

Waiting for the device of alice@example.org to reply… [NOTICED][INFO]
Msg#2008🔒: (Contact#Contact#2001): You joined the channel. [FRESH][INFO]
Msg#2010🔒: (Contact#Contact#2001): hi [FRESH]
Msg#2011🔒: (Contact#Contact#2001): Member Me removed by alice@example.org. [FRESH][INFO]
Expand Down