docs: SecurejoinInviterProgress never returns an error

This commit is contained in:
link2xt
2025-09-23 14:33:35 +00:00
committed by l
parent 42b4b83f8e
commit 4c66518a68
4 changed files with 11 additions and 28 deletions

View File

@@ -6560,9 +6560,7 @@ void dc_event_unref(dc_event_t* event);
* generated by dc_get_securejoin_qr(). * generated by dc_get_securejoin_qr().
* *
* @param data1 (int) The ID of the contact that wants to join. * @param data1 (int) The ID of the contact that wants to join.
* @param data2 (int) The progress as: * @param data2 (int) The progress, always 1000.
* 0=Error.
* 1000=Protocol finished for this contact.
*/ */
#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060 #define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060

View File

@@ -294,8 +294,8 @@ pub enum EventType {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ImexFileWritten { path: String }, ImexFileWritten { path: String },
/// Progress information of a secure-join handshake from the view of the inviter /// Progress event sent when SecureJoin protocol has finished
/// (Alice, the person who shows the QR code). /// 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 /// These events are typically sent after a joiner has scanned the QR code
/// generated by getChatSecurejoinQrCodeSvg(). /// generated by getChatSecurejoinQrCodeSvg().
@@ -309,9 +309,7 @@ pub enum EventType {
/// as `BasicChat.chatType` ([`crate::api::types::chat::BasicChat::chat_type`]). /// as `BasicChat.chatType` ([`crate::api::types::chat::BasicChat::chat_type`]).
chat_type: u32, chat_type: u32,
/// Progress as: /// Progress, always 1000.
/// 0=Error.
/// 1000=Protocol finished for this contact.
progress: usize, progress: usize,
}, },

View File

@@ -276,11 +276,7 @@ pub enum EventType {
/// The type of the joined chat. /// The type of the joined chat.
chat_type: Chattype, chat_type: Chattype,
/// Progress as: /// Progress, always 1000.
/// 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: usize, progress: usize,
}, },

View File

@@ -16,7 +16,6 @@ use crate::events::EventType;
use crate::headerdef::HeaderDef; use crate::headerdef::HeaderDef;
use crate::key::{DcKey, Fingerprint, load_self_public_key}; use crate::key::{DcKey, Fingerprint, load_self_public_key};
use crate::log::{error, info, warn}; use crate::log::{error, info, warn};
use crate::logged_debug_assert;
use crate::message::{Message, Viewtype}; use crate::message::{Message, Viewtype};
use crate::mimeparser::{MimeMessage, SystemMessage}; use crate::mimeparser::{MimeMessage, SystemMessage};
use crate::param::Param; use crate::param::Param;
@@ -32,23 +31,15 @@ use qrinvite::QrInvite;
use crate::token::Namespace; use crate::token::Namespace;
fn inviter_progress( fn inviter_progress(context: &Context, contact_id: ContactId, is_group: bool) -> Result<()> {
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)."
);
let chat_type = if is_group { let chat_type = if is_group {
Chattype::Group Chattype::Group
} else { } else {
Chattype::Single Chattype::Single
}; };
// No other values are used.
let progress = 1000;
context.emit_event(EventType::SecurejoinInviterProgress { context.emit_event(EventType::SecurejoinInviterProgress {
contact_id, contact_id,
chat_type, 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) chat::add_contact_to_chat_ex(context, Nosync, group_chat_id, contact_id, true)
.await?; .await?;
let is_group = true; 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 // 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. // member twice. Another device will know the member's key from Autocrypt-Gossip.
Ok(HandshakeMessage::Done) Ok(HandshakeMessage::Done)
@@ -445,7 +436,7 @@ pub(crate) async fn handle_securejoin_handshake(
.context("failed sending vc-contact-confirm message")?; .context("failed sending vc-contact-confirm message")?;
let is_group = false; 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) 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 let is_group = mime_message
.get_header(HeaderDef::ChatGroupMemberAdded) .get_header(HeaderDef::ChatGroupMemberAdded)
.is_some(); .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" { if step == "vg-request-with-auth" || step == "vc-request-with-auth" {