More multidevice fixes; it's still not working completely

This commit is contained in:
Hocuri
2025-07-21 17:32:46 +02:00
parent eadbf41383
commit fba6e885ae
4 changed files with 14 additions and 10 deletions

View File

@@ -3785,7 +3785,9 @@ async fn test_sync_broadcast() -> Result<()> {
assert_eq!(a1_broadcast_chat.get_name(), a0_broadcast_chat.get_name());
assert!(get_chat_contacts(alice1, a1_broadcast_id).await?.is_empty());
add_contact_to_chat(alice0, a0_broadcast_id, a0b_contact_id).await?;
sync(alice0, alice1).await;
let sent = alice0.pop_sent_msg().await;
let rcvd = alice1.recv_msg(&sent).await;
dbg!(rcvd); // TODO
// This also imports Bob's key from the vCard.
// Otherwise it is possible that second device

View File

@@ -1404,7 +1404,6 @@ impl MimeFactory {
}
}
SystemMessage::MemberAddedToGroup => {
ensure!(chat.typ != Chattype::OutBroadcast);
// TODO: lookup the contact by ID rather than email address.
// We are adding key-contacts, the cannot be looked up by address.
let email_to_add = msg.param.get(Param::Arg).unwrap_or_default();

View File

@@ -3482,15 +3482,17 @@ async fn apply_out_broadcast_changes(
.await?;
if let Some(_removed_addr) = mime_parser.get_header(HeaderDef::ChatGroupMemberRemoved) {
// The sender of the message left the broadcast channel
remove_from_chat_contacts_table(context, chat.id, from_id).await?;
if from_id != ContactId::SELF {
// The sender of the message left the broadcast channel
remove_from_chat_contacts_table(context, chat.id, from_id).await?;
return Ok(GroupChangesInfo {
better_msg: Some("".to_string()),
added_removed_id: None,
silent: true,
extra_msgs: vec![],
});
return Ok(GroupChangesInfo {
better_msg: Some("".to_string()),
added_removed_id: None,
silent: true,
extra_msgs: vec![],
});
}
}
if send_event_chat_modified {

View File

@@ -306,6 +306,7 @@ pub(crate) fn create_id() -> String {
/// and is returned as 64 Base64 characters, each containing 6 bits of entropy.
/// 384 is chosen because it is sufficiently secure
/// (larger than AES-128 keys used for message encryption)
/// TODO: Is it still true that we use AES-128? This info is taken from create_id() comment above.
/// and divides both by 8 (byte size) and 6 (number of bits in a single Base64 character).
// TODO ask someone what a good size would be here
pub(crate) fn create_broadcast_shared_secret() -> String {