api: emit JoinerProgress(1000) event when Bob verifies Alice

This commit is contained in:
link2xt
2023-11-09 01:02:33 +00:00
parent 3e194969c0
commit fc09210aea
4 changed files with 7 additions and 3 deletions

View File

@@ -6260,6 +6260,7 @@ void dc_event_unref(dc_event_t* event);
* @param data2 (int) The progress as: * @param data2 (int) The progress as:
* 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." * 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
* (Bob has verified alice and waits until Alice does the same for him) * (Bob has verified alice and waits until Alice does the same for him)
* 1000=vg-member-added/vc-contact-confirm received
*/ */
#define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061 #define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061

View File

@@ -250,6 +250,7 @@ pub enum EventType {
/// Progress as: /// Progress as:
/// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." /// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
/// (Bob has verified alice and waits until Alice does the same for him) /// (Bob has verified alice and waits until Alice does the same for him)
/// 1000=vg-member-added/vc-contact-confirm received
progress: usize, progress: usize,
}, },

View File

@@ -767,6 +767,7 @@ mod tests {
use crate::chat; use crate::chat;
use crate::chat::ProtectionStatus; use crate::chat::ProtectionStatus;
use crate::chatlist::Chatlist; use crate::chatlist::Chatlist;
use crate::constants::Chattype;
use crate::contact::ContactAddress; use crate::contact::ContactAddress;
use crate::contact::VerifiedStatus; use crate::contact::VerifiedStatus;
use crate::peerstate::Peerstate; use crate::peerstate::Peerstate;

View File

@@ -132,6 +132,7 @@ pub(super) async fn handle_contact_confirm(
// verify both contacts (this could be a bug/security issue, see // verify both contacts (this could be a bug/security issue, see
// e.g. https://github.com/deltachat/deltachat-core-rust/issues/1177). // e.g. https://github.com/deltachat/deltachat-core-rust/issues/1177).
bobstate.notify_peer_verified(context).await?; bobstate.notify_peer_verified(context).await?;
bobstate.emit_progress(context, JoinerProgress::Succeeded);
Ok(retval) Ok(retval)
} }
Some(_) => { Some(_) => {
@@ -255,8 +256,8 @@ enum JoinerProgress {
/// ///
/// Typically shows as "alice@addr verified, introducing myself." /// Typically shows as "alice@addr verified, introducing myself."
RequestWithAuthSent, RequestWithAuthSent,
// /// Completed securejoin. /// Completed securejoin.
// Succeeded, Succeeded,
} }
impl From<JoinerProgress> for usize { impl From<JoinerProgress> for usize {
@@ -264,7 +265,7 @@ impl From<JoinerProgress> for usize {
match progress { match progress {
JoinerProgress::Error => 0, JoinerProgress::Error => 0,
JoinerProgress::RequestWithAuthSent => 400, JoinerProgress::RequestWithAuthSent => 400,
// JoinerProgress::Succeeded => 1000, JoinerProgress::Succeeded => 1000,
} }
} }
} }