add vc-contact-confirm-received message needed for multi-device-verification

This commit is contained in:
B. Petersen
2020-02-28 15:01:15 +01:00
committed by holger krekel
parent 24730e7ad6
commit 5ded8fb400

View File

@@ -707,17 +707,21 @@ pub(crate) fn handle_securejoin_handshake(
} }
secure_connection_established(context, contact_chat_id); secure_connection_established(context, contact_chat_id);
context.bob.write().unwrap().expects = 0; context.bob.write().unwrap().expects = 0;
if join_vg {
// Bob -> Alice // Bob -> Alice
send_handshake_msg( send_handshake_msg(
context, context,
contact_chat_id, contact_chat_id,
"vg-member-added-received", if join_vg {
"", "vg-member-added-received"
None, } else {
"", "vc-contact-confirm-received" // only for observe_securejoin_on_other_device()
); },
} "",
None,
"",
);
context.bob.write().unwrap().status = 1; context.bob.write().unwrap().status = 1;
context.stop_ongoing(); context.stop_ongoing();
Ok(if join_vg { Ok(if join_vg {
@@ -726,7 +730,7 @@ pub(crate) fn handle_securejoin_handshake(
HandshakeMessage::Ignore // "Done" deletes the message and breaks multi-device HandshakeMessage::Ignore // "Done" deletes the message and breaks multi-device
}) })
} }
"vg-member-added-received" => { "vg-member-added-received" | "vc-contact-confirm-received" => {
/*========================================================== /*==========================================================
==== Alice - the inviter side ==== ==== Alice - the inviter side ====
==== Step 8 in "Out-of-band verified groups" protocol ==== ==== Step 8 in "Out-of-band verified groups" protocol ====
@@ -734,29 +738,31 @@ pub(crate) fn handle_securejoin_handshake(
if let Ok(contact) = Contact::get_by_id(context, contact_id) { if let Ok(contact) = Contact::get_by_id(context, contact_id) {
if contact.is_verified(context) == VerifiedStatus::Unverified { if contact.is_verified(context) == VerifiedStatus::Unverified {
warn!(context, "vg-member-added-received invalid.",); warn!(context, "{} invalid.", step);
return Ok(HandshakeMessage::Ignore); return Ok(HandshakeMessage::Ignore);
} }
inviter_progress!(context, contact_id, 800); if join_vg {
inviter_progress!(context, contact_id, 1000); inviter_progress!(context, contact_id, 800);
let field_grpid = mime_message inviter_progress!(context, contact_id, 1000);
.get(HeaderDef::SecureJoinGroup) let field_grpid = mime_message
.map(|s| s.as_str()) .get(HeaderDef::SecureJoinGroup)
.unwrap_or_else(|| ""); .map(|s| s.as_str())
let (group_chat_id, _, _) = chat::get_chat_id_by_grpid(context, &field_grpid) .unwrap_or_else(|| "");
.map_err(|err| { let (group_chat_id, _, _) = chat::get_chat_id_by_grpid(context, &field_grpid)
.map_err(|err| {
warn!(context, "Failed to lookup chat_id from grpid: {}", err); warn!(context, "Failed to lookup chat_id from grpid: {}", err);
HandshakeError::ChatNotFound { HandshakeError::ChatNotFound {
group: field_grpid.to_string(), group: field_grpid.to_string(),
} }
})?; })?;
context.call_cb(Event::MemberAdded { context.call_cb(Event::MemberAdded {
chat_id: group_chat_id, chat_id: group_chat_id,
contact_id, contact_id,
}); });
}
Ok(HandshakeMessage::Ignore) // "Done" deletes the message and breaks multi-device Ok(HandshakeMessage::Ignore) // "Done" deletes the message and breaks multi-device
} else { } else {
warn!(context, "vg-member-added-received invalid.",); warn!(context, "{} invalid.", step);
Ok(HandshakeMessage::Ignore) Ok(HandshakeMessage::Ignore)
} }
} }