feat: Make reacting to v2 invites generic over the type of the invite (contact/group/broadcast)

This commit is contained in:
Hocuri
2025-08-11 16:00:31 +02:00
parent 9dc590cb35
commit 479a5632fb

View File

@@ -69,22 +69,13 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
} }
info!(context, "Using fast securejoin with symmetric encryption"); info!(context, "Using fast securejoin with symmetric encryption");
let mut msg = Message { send_handshake_message(
viewtype: Viewtype::Text, context,
// TODO I may want to make this generic also for group/contacts &invite,
text: "Secure-Join: vb-request-with-auth".to_string(), private_chat_id,
hidden: true, BobHandshakeMsg::RequestWithAuth,
..Default::default() )
}; .await?;
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
msg.param.set(Param::Arg, "vb-request-with-auth");
msg.param.set(Param::Arg2, invite.authcode());
msg.param.set_int(Param::GuaranteeE2ee, 1);
let bob_fp = self_fingerprint(context).await?;
msg.param.set(Param::Arg3, bob_fp);
chat::send_msg(context, private_chat_id, &mut msg).await?;
context.emit_event(EventType::SecurejoinJoinerProgress { context.emit_event(EventType::SecurejoinJoinerProgress {
contact_id: invite.contact_id(), contact_id: invite.contact_id(),
@@ -388,9 +379,7 @@ impl BobHandshakeMsg {
Self::RequestWithAuth => match invite { Self::RequestWithAuth => match invite {
QrInvite::Contact { .. } => "vc-request-with-auth", QrInvite::Contact { .. } => "vc-request-with-auth",
QrInvite::Group { .. } => "vg-request-with-auth", QrInvite::Group { .. } => "vg-request-with-auth",
QrInvite::Broadcast { .. } => { QrInvite::Broadcast { .. } => "vb-request-with-auth",
panic!("There is no request-with-auth for broadcasts")
} // TODO remove panic
}, },
} }
} }