Skip to content

Commit bfedba9

Browse files
committed
feat: Make reacting to v2 invites generic over the type of the invite (contact/group/broadcast)
1 parent 5e2fdd1 commit bfedba9

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/securejoin/bob.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,13 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
6969
}
7070
info!(context, "Using fast securejoin with symmetric encryption");
7171

72-
let mut msg = Message {
73-
viewtype: Viewtype::Text,
74-
// TODO I may want to make this generic also for group/contacts
75-
text: "Secure-Join: vb-request-with-auth".to_string(),
76-
hidden: true,
77-
..Default::default()
78-
};
79-
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
80-
81-
msg.param.set(Param::Arg, "vb-request-with-auth");
82-
msg.param.set(Param::Arg2, invite.authcode());
83-
msg.param.set_int(Param::GuaranteeE2ee, 1);
84-
let bob_fp = self_fingerprint(context).await?;
85-
msg.param.set(Param::Arg3, bob_fp);
86-
87-
chat::send_msg(context, private_chat_id, &mut msg).await?;
72+
send_handshake_message(
73+
context,
74+
&invite,
75+
private_chat_id,
76+
BobHandshakeMsg::RequestWithAuth,
77+
)
78+
.await?;
8879

8980
context.emit_event(EventType::SecurejoinJoinerProgress {
9081
contact_id: invite.contact_id(),
@@ -388,9 +379,7 @@ impl BobHandshakeMsg {
388379
Self::RequestWithAuth => match invite {
389380
QrInvite::Contact { .. } => "vc-request-with-auth",
390381
QrInvite::Group { .. } => "vg-request-with-auth",
391-
QrInvite::Broadcast { .. } => {
392-
panic!("There is no request-with-auth for broadcasts")
393-
} // TODO remove panic
382+
QrInvite::Broadcast { .. } => "vb-request-with-auth",
394383
},
395384
}
396385
}

0 commit comments

Comments
 (0)