mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
api!: get rid of inviter progress other than 0 and 1000
UIs don't display a dialog with a progress bar anyway.
This commit is contained in:
@@ -6561,9 +6561,7 @@ void dc_event_unref(dc_event_t* event);
|
|||||||
*
|
*
|
||||||
* @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 as:
|
||||||
* 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
* 0=Error.
|
||||||
* 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.
|
* 1000=Protocol finished for this contact.
|
||||||
*/
|
*/
|
||||||
#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
|
#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
|
||||||
|
|||||||
@@ -310,9 +310,7 @@ pub enum EventType {
|
|||||||
chat_type: u32,
|
chat_type: u32,
|
||||||
|
|
||||||
/// Progress as:
|
/// Progress as:
|
||||||
/// 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
/// 0=Error.
|
||||||
/// 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.
|
/// 1000=Protocol finished for this contact.
|
||||||
progress: usize,
|
progress: usize,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ fn inviter_progress(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
logged_debug_assert!(
|
logged_debug_assert!(
|
||||||
context,
|
context,
|
||||||
progress <= 1000,
|
progress == 0 || progress == 1000,
|
||||||
"inviter_progress: contact {contact_id}, progress={progress}, but value in range 0..1000 expected with: 0=error, 1..999=progress, 1000=success."
|
"inviter_progress: contact {contact_id}, progress={progress}, but value is not 0 (error) or 1000 (success)."
|
||||||
);
|
);
|
||||||
let chat_type = match step.get(..3) {
|
let chat_type = match step.get(..3) {
|
||||||
Some("vc-") => Chattype::Single,
|
Some("vc-") => Chattype::Single,
|
||||||
@@ -321,8 +321,6 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
return Ok(HandshakeMessage::Ignore);
|
return Ok(HandshakeMessage::Ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
inviter_progress(context, contact_id, step, 300)?;
|
|
||||||
|
|
||||||
let from_addr = ContactAddress::new(&mime_message.from.addr)?;
|
let from_addr = ContactAddress::new(&mime_message.from.addr)?;
|
||||||
let autocrypt_fingerprint = mime_message.autocrypt_fingerprint.as_deref().unwrap_or("");
|
let autocrypt_fingerprint = mime_message.autocrypt_fingerprint.as_deref().unwrap_or("");
|
||||||
let (autocrypt_contact_id, _) = Contact::add_or_lookup_ex(
|
let (autocrypt_contact_id, _) = Contact::add_or_lookup_ex(
|
||||||
@@ -416,7 +414,6 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
ChatId::create_for_contact(context, contact_id).await?;
|
ChatId::create_for_contact(context, contact_id).await?;
|
||||||
}
|
}
|
||||||
context.emit_event(EventType::ContactsChanged(Some(contact_id)));
|
context.emit_event(EventType::ContactsChanged(Some(contact_id)));
|
||||||
inviter_progress(context, contact_id, step, 600)?;
|
|
||||||
if let Some(group_chat_id) = group_chat_id {
|
if let Some(group_chat_id) = group_chat_id {
|
||||||
// Join group.
|
// Join group.
|
||||||
secure_connection_established(
|
secure_connection_established(
|
||||||
@@ -428,7 +425,6 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
.await?;
|
.await?;
|
||||||
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?;
|
||||||
inviter_progress(context, contact_id, step, 800)?;
|
|
||||||
inviter_progress(context, contact_id, step, 1000)?;
|
inviter_progress(context, contact_id, step, 1000)?;
|
||||||
// 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.
|
||||||
@@ -565,9 +561,6 @@ pub(crate) async fn observe_securejoin_on_other_device(
|
|||||||
|
|
||||||
ChatId::set_protection_for_contact(context, contact_id, mime_message.timestamp_sent).await?;
|
ChatId::set_protection_for_contact(context, contact_id, mime_message.timestamp_sent).await?;
|
||||||
|
|
||||||
if step == "vg-member-added" {
|
|
||||||
inviter_progress(context, contact_id, step, 800)?;
|
|
||||||
}
|
|
||||||
if step == "vg-member-added" || step == "vc-contact-confirm" {
|
if step == "vg-member-added" || step == "vc-contact-confirm" {
|
||||||
inviter_progress(context, contact_id, step, 1000)?;
|
inviter_progress(context, contact_id, step, 1000)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user