mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
non-blocking group QR joins (#2508)
* refactor: cleanup send_handshake_msg() - rename to send_alice_handshake_msg() as used by Alice only - remove dead code from Bob (Bob's code is at BobState::send_handshake_message() since some time) - take a contact_id and not a chat_id; this makes things less confusing when info-messages are put to the final group chat * always directly return chat-id from dc_join_securejoin() * take care not to create a group twice * adapt documentation * add info-msg on group invites; add inviter directly after creation * document existing 'joinqr' command in repl tool * do not create empty one-to-one chats for group-joins * refactor: cleanup fingerprint_equals_sender() - the function takes a contact_id directly now. before it consumes the first contact of a one-to-one chat - which may be easily confused with the group-chat in creation. moreover, the conversion contact_id -> chat_id -> contact_id is unneeded overhead. * show info-messages in destination chat for alice * fingerprint_equals_sender() returns Err on database failure * tweak documentation * clarify what an 'unfinished tasks' task is. * add regression test for create_for_contact_with_blocked() * rename Blocked::Manually to better fitting Blocked::Yes * tweak test_secure_join() and make sure, Alice and Bob have only on chat after a group-join
This commit is contained in:
@@ -326,6 +326,13 @@ pub enum StockMessage {
|
||||
|
||||
#[strum(props(fallback = "%1$s of %2$s used"))]
|
||||
PartOfTotallUsed = 116,
|
||||
|
||||
#[strum(props(fallback = "%1$s invited you to join this group.\n\n\
|
||||
Waiting for the device of %2$s to reply…"))]
|
||||
SecureJoinStarted = 117,
|
||||
|
||||
#[strum(props(fallback = "%1$s replied, waiting for being added to the group…"))]
|
||||
SecureJoinReplies = 118,
|
||||
}
|
||||
|
||||
impl StockMessage {
|
||||
@@ -591,6 +598,32 @@ pub(crate) async fn e2e_preferred(context: &Context) -> String {
|
||||
translated(context, StockMessage::E2ePreferred).await
|
||||
}
|
||||
|
||||
/// Stock string: `%1$s invited you to join this group. Waiting for the device of %2$s to reply…`.
|
||||
pub(crate) async fn secure_join_started(context: &Context, inviter_contact_id: u32) -> String {
|
||||
if let Ok(contact) = Contact::get_by_id(context, inviter_contact_id).await {
|
||||
translated(context, StockMessage::SecureJoinStarted)
|
||||
.await
|
||||
.replace1(contact.get_name_n_addr())
|
||||
.replace2(contact.get_display_name())
|
||||
} else {
|
||||
format!(
|
||||
"secure_join_started: unknown contact {}",
|
||||
inviter_contact_id
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stock string: `%1$s replied, waiting for being added to the group…`.
|
||||
pub(crate) async fn secure_join_replies(context: &Context, contact_id: u32) -> String {
|
||||
if let Ok(contact) = Contact::get_by_id(context, contact_id).await {
|
||||
translated(context, StockMessage::SecureJoinReplies)
|
||||
.await
|
||||
.replace1(contact.get_display_name())
|
||||
} else {
|
||||
format!("secure_join_replies: unknown contact {}", contact_id)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stock string: `%1$s verified.`.
|
||||
pub(crate) async fn contact_verified(context: &Context, contact_addr: impl AsRef<str>) -> String {
|
||||
translated(context, StockMessage::ContactVerified)
|
||||
|
||||
Reference in New Issue
Block a user