diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index bb759de4d..1eddf6b66 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -6560,9 +6560,7 @@ void dc_event_unref(dc_event_t* event); * generated by dc_get_securejoin_qr(). * * @param data1 (int) The ID of the contact that wants to join. - * @param data2 (int) The progress as: - * 0=Error. - * 1000=Protocol finished for this contact. + * @param data2 (int) The progress, always 1000. */ #define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060 diff --git a/deltachat-jsonrpc/src/api/types/events.rs b/deltachat-jsonrpc/src/api/types/events.rs index 1028522c5..8c8808a1f 100644 --- a/deltachat-jsonrpc/src/api/types/events.rs +++ b/deltachat-jsonrpc/src/api/types/events.rs @@ -294,8 +294,8 @@ pub enum EventType { #[serde(rename_all = "camelCase")] ImexFileWritten { path: String }, - /// Progress information of a secure-join handshake from the view of the inviter - /// (Alice, the person who shows the QR code). + /// Progress event sent when SecureJoin protocol has finished + /// from the view of the inviter (Alice, the person who shows the QR code). /// /// These events are typically sent after a joiner has scanned the QR code /// generated by getChatSecurejoinQrCodeSvg(). @@ -309,9 +309,7 @@ pub enum EventType { /// as `BasicChat.chatType` ([`crate::api::types::chat::BasicChat::chat_type`]). chat_type: u32, - /// Progress as: - /// 0=Error. - /// 1000=Protocol finished for this contact. + /// Progress, always 1000. progress: usize, }, diff --git a/src/events/payload.rs b/src/events/payload.rs index 83e8fa923..e920b5e24 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -276,11 +276,7 @@ pub enum EventType { /// The type of the joined chat. chat_type: Chattype, - /// Progress as: - /// 300=vg-/vc-request received, typically shown as "bob@addr joins". - /// 600=vg-/vc-request-with-auth received and verified, typically shown as "bob@addr verified". - /// 800=contact added to chat, shown as "bob@addr securely joined GROUP". Only for the verified-group-protocol. - /// 1000=Protocol finished for this contact. + /// Progress, always 1000. progress: usize, }, diff --git a/src/securejoin.rs b/src/securejoin.rs index 2da463e6b..d388ac4cc 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -16,7 +16,6 @@ use crate::events::EventType; use crate::headerdef::HeaderDef; use crate::key::{DcKey, Fingerprint, load_self_public_key}; use crate::log::{error, info, warn}; -use crate::logged_debug_assert; use crate::message::{Message, Viewtype}; use crate::mimeparser::{MimeMessage, SystemMessage}; use crate::param::Param; @@ -32,23 +31,15 @@ use qrinvite::QrInvite; use crate::token::Namespace; -fn inviter_progress( - context: &Context, - contact_id: ContactId, - is_group: bool, - progress: usize, -) -> Result<()> { - logged_debug_assert!( - context, - progress == 0 || progress == 1000, - "inviter_progress: contact {contact_id}, progress={progress}, but value is not 0 (error) or 1000 (success)." - ); +fn inviter_progress(context: &Context, contact_id: ContactId, is_group: bool) -> Result<()> { let chat_type = if is_group { Chattype::Group } else { Chattype::Single }; + // No other values are used. + let progress = 1000; context.emit_event(EventType::SecurejoinInviterProgress { contact_id, chat_type, @@ -427,7 +418,7 @@ pub(crate) async fn handle_securejoin_handshake( chat::add_contact_to_chat_ex(context, Nosync, group_chat_id, contact_id, true) .await?; let is_group = true; - inviter_progress(context, contact_id, is_group, 1000)?; + inviter_progress(context, contact_id, is_group)?; // IMAP-delete the message to avoid handling it by another device and adding the // member twice. Another device will know the member's key from Autocrypt-Gossip. Ok(HandshakeMessage::Done) @@ -445,7 +436,7 @@ pub(crate) async fn handle_securejoin_handshake( .context("failed sending vc-contact-confirm message")?; let is_group = false; - inviter_progress(context, contact_id, is_group, 1000)?; + inviter_progress(context, contact_id, is_group)?; Ok(HandshakeMessage::Ignore) // "Done" would delete the message and break multi-device (the key from Autocrypt-header is needed) } } @@ -568,7 +559,7 @@ pub(crate) async fn observe_securejoin_on_other_device( let is_group = mime_message .get_header(HeaderDef::ChatGroupMemberAdded) .is_some(); - inviter_progress(context, contact_id, is_group, 1000)?; + inviter_progress(context, contact_id, is_group)?; } if step == "vg-request-with-auth" || step == "vc-request-with-auth" {