feat: Add broadcast QR type (todo: documentation)

This commit is contained in:
Hocuri
2025-07-21 17:37:48 +02:00
parent 789b923bb8
commit 3389e93820
5 changed files with 104 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
let hidden = match invite {
QrInvite::Contact { .. } => Blocked::Not,
QrInvite::Group { .. } => Blocked::Yes,
QrInvite::Broadcast { .. } => Blocked::Yes,
};
let chat_id = ChatId::create_for_contact_with_blocked(context, invite.contact_id(), hidden)
.await
@@ -113,6 +114,7 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
chat::add_info_msg(context, group_chat_id, &msg, time()).await?;
Ok(group_chat_id)
}
QrInvite::Broadcast { .. } => {}
QrInvite::Contact { .. } => {
// For setup-contact the BobState already ensured the 1:1 chat exists because it
// uses it to send the handshake messages.

View File

@@ -29,6 +29,13 @@ pub enum QrInvite {
invitenumber: String,
authcode: String,
},
Broadcast {
broadcast_name: String,
grpid: String,
contact_id: ContactId,
fingerprint: Fingerprint,
shared_secret: String,
},
}
impl QrInvite {
@@ -95,6 +102,19 @@ impl TryFrom<Qr> for QrInvite {
invitenumber,
authcode,
}),
Qr::AskJoinBroadcast {
broadcast_name,
grpid,
contact_id,
fingerprint,
shared_secret,
} => Ok(QrInvite::Broadcast {
broadcast_name,
grpid,
contact_id,
fingerprint,
shared_secret,
}),
_ => bail!("Unsupported QR type"),
}
}