Skip to content

Commit fba6e88

Browse files
committed
More multidevice fixes; it's still not working completely
1 parent eadbf41 commit fba6e88

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

src/chat/chat_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3785,7 +3785,9 @@ async fn test_sync_broadcast() -> Result<()> {
37853785
assert_eq!(a1_broadcast_chat.get_name(), a0_broadcast_chat.get_name());
37863786
assert!(get_chat_contacts(alice1, a1_broadcast_id).await?.is_empty());
37873787
add_contact_to_chat(alice0, a0_broadcast_id, a0b_contact_id).await?;
3788-
sync(alice0, alice1).await;
3788+
let sent = alice0.pop_sent_msg().await;
3789+
let rcvd = alice1.recv_msg(&sent).await;
3790+
dbg!(rcvd); // TODO
37893791

37903792
// This also imports Bob's key from the vCard.
37913793
// Otherwise it is possible that second device

src/mimefactory.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,6 @@ impl MimeFactory {
14041404
}
14051405
}
14061406
SystemMessage::MemberAddedToGroup => {
1407-
ensure!(chat.typ != Chattype::OutBroadcast);
14081407
// TODO: lookup the contact by ID rather than email address.
14091408
// We are adding key-contacts, the cannot be looked up by address.
14101409
let email_to_add = msg.param.get(Param::Arg).unwrap_or_default();

src/receive_imf.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,15 +3482,17 @@ async fn apply_out_broadcast_changes(
34823482
.await?;
34833483

34843484
if let Some(_removed_addr) = mime_parser.get_header(HeaderDef::ChatGroupMemberRemoved) {
3485-
// The sender of the message left the broadcast channel
3486-
remove_from_chat_contacts_table(context, chat.id, from_id).await?;
3487-
3488-
return Ok(GroupChangesInfo {
3489-
better_msg: Some("".to_string()),
3490-
added_removed_id: None,
3491-
silent: true,
3492-
extra_msgs: vec![],
3493-
});
3485+
if from_id != ContactId::SELF {
3486+
// The sender of the message left the broadcast channel
3487+
remove_from_chat_contacts_table(context, chat.id, from_id).await?;
3488+
3489+
return Ok(GroupChangesInfo {
3490+
better_msg: Some("".to_string()),
3491+
added_removed_id: None,
3492+
silent: true,
3493+
extra_msgs: vec![],
3494+
});
3495+
}
34943496
}
34953497

34963498
if send_event_chat_modified {

src/tools.rs

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

0 commit comments

Comments
 (0)