diff --git a/CHANGELOG.md b/CHANGELOG.md index 02271ee991..77a1318516 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.142.12] - 2024-09-02 + +### Fixes + +- Display Config::MdnsEnabled as true by default ([#5948](https://github.com/deltachat/deltachat-core-rust/pull/5948)). + ## [1.142.11] - 2024-08-30 ### Fixes @@ -4799,3 +4805,4 @@ https://github.com/deltachat/deltachat-core-rust/pulls?q=is%3Apr+is%3Aclosed [1.142.9]: https://github.com/deltachat/deltachat-core-rust/compare/v1.142.8...v1.142.9 [1.142.10]: https://github.com/deltachat/deltachat-core-rust/compare/v1.142.9..v1.142.10 [1.142.11]: https://github.com/deltachat/deltachat-core-rust/compare/v1.142.10..v1.142.11 +[1.142.12]: https://github.com/deltachat/deltachat-core-rust/compare/v1.142.11..v1.142.12 diff --git a/Cargo.lock b/Cargo.lock index e3cff9b401..b072f346b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1240,7 +1240,7 @@ dependencies = [ [[package]] name = "deltachat" -version = "1.142.11" +version = "1.142.12" dependencies = [ "anyhow", "async-broadcast", @@ -1334,7 +1334,7 @@ dependencies = [ [[package]] name = "deltachat-jsonrpc" -version = "1.142.11" +version = "1.142.12" dependencies = [ "anyhow", "async-channel 2.3.1", @@ -1359,7 +1359,7 @@ dependencies = [ [[package]] name = "deltachat-repl" -version = "1.142.11" +version = "1.142.12" dependencies = [ "anyhow", "deltachat", @@ -1374,7 +1374,7 @@ dependencies = [ [[package]] name = "deltachat-rpc-server" -version = "1.142.11" +version = "1.142.12" dependencies = [ "anyhow", "deltachat", @@ -1403,7 +1403,7 @@ dependencies = [ [[package]] name = "deltachat_ffi" -version = "1.142.11" +version = "1.142.12" dependencies = [ "anyhow", "deltachat", @@ -3066,7 +3066,7 @@ dependencies = [ "iroh-quinn-proto", "iroh-quinn-udp", "pin-project-lite", - "rustc-hash", + "rustc-hash 1.1.0", "rustls 0.21.11", "thiserror", "tokio", @@ -3082,7 +3082,7 @@ dependencies = [ "bytes", "rand 0.8.5", "ring", - "rustc-hash", + "rustc-hash 1.1.0", "rustls 0.21.11", "rustls-native-certs", "slab", @@ -4452,7 +4452,7 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 1.1.0", "rustls 0.23.10", "thiserror", "tokio", @@ -4461,14 +4461,14 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.3" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" dependencies = [ "bytes", "rand 0.8.5", "ring", - "rustc-hash", + "rustc-hash 2.0.0", "rustls 0.23.10", "slab", "thiserror", @@ -4891,6 +4891,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 42a13cc455..4e8e337b60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat" -version = "1.142.11" +version = "1.142.12" edition = "2021" license = "MPL-2.0" rust-version = "1.77" diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 3da1362239..3747b80b4c 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat_ffi" -version = "1.142.11" +version = "1.142.12" description = "Deltachat FFI" edition = "2018" readme = "README.md" diff --git a/deltachat-jsonrpc/Cargo.toml b/deltachat-jsonrpc/Cargo.toml index fb29e265e8..c248c28f9e 100644 --- a/deltachat-jsonrpc/Cargo.toml +++ b/deltachat-jsonrpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-jsonrpc" -version = "1.142.11" +version = "1.142.12" description = "DeltaChat JSON-RPC API" edition = "2021" default-run = "deltachat-jsonrpc-server" diff --git a/deltachat-jsonrpc/typescript/package.json b/deltachat-jsonrpc/typescript/package.json index 546aaea19f..eb074b91f5 100644 --- a/deltachat-jsonrpc/typescript/package.json +++ b/deltachat-jsonrpc/typescript/package.json @@ -58,5 +58,5 @@ }, "type": "module", "types": "dist/deltachat.d.ts", - "version": "1.142.11" + "version": "1.142.12" } diff --git a/deltachat-repl/Cargo.toml b/deltachat-repl/Cargo.toml index 8fdfcde6c9..2e6f3dc85b 100644 --- a/deltachat-repl/Cargo.toml +++ b/deltachat-repl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-repl" -version = "1.142.11" +version = "1.142.12" license = "MPL-2.0" edition = "2021" repository = "https://github.com/deltachat/deltachat-core-rust" diff --git a/deltachat-rpc-client/pyproject.toml b/deltachat-rpc-client/pyproject.toml index 87698ae183..7c389e086c 100644 --- a/deltachat-rpc-client/pyproject.toml +++ b/deltachat-rpc-client/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "deltachat-rpc-client" -version = "1.142.11" +version = "1.142.12" description = "Python client for Delta Chat core JSON-RPC interface" classifiers = [ "Development Status :: 5 - Production/Stable", diff --git a/deltachat-rpc-client/tests/test_securejoin.py b/deltachat-rpc-client/tests/test_securejoin.py index 8969de01dc..7a0fdbaae3 100644 --- a/deltachat-rpc-client/tests/test_securejoin.py +++ b/deltachat-rpc-client/tests/test_securejoin.py @@ -62,7 +62,7 @@ def test_qr_setup_contact_svg(acfactory) -> None: @pytest.mark.parametrize("protect", [True, False]) def test_qr_securejoin(acfactory, protect, tmp_path): - alice, bob = acfactory.get_online_accounts(2) + alice, bob, fiona = acfactory.get_online_accounts(3) # Setup second device for Alice # to test observing securejoin protocol. @@ -112,6 +112,13 @@ def test_qr_securejoin(acfactory, protect, tmp_path): alice2_contact_bob_snapshot = alice2_contact_bob.get_snapshot() assert alice2_contact_bob_snapshot.is_verified + # The QR code token is synced, so alice2 must be able to handle join requests. + logging.info("Fiona joins verified group via alice2") + alice.stop_io() + fiona.secure_join(qr_code) + alice2.wait_for_securejoin_inviter_success() + fiona.wait_for_securejoin_joiner_success() + def test_qr_securejoin_contact_request(acfactory) -> None: """Alice invites Bob to a group when Bob's chat with Alice is in a contact request mode.""" diff --git a/deltachat-rpc-server/Cargo.toml b/deltachat-rpc-server/Cargo.toml index 81a51ab75f..ef9de17dff 100644 --- a/deltachat-rpc-server/Cargo.toml +++ b/deltachat-rpc-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-rpc-server" -version = "1.142.11" +version = "1.142.12" description = "DeltaChat JSON-RPC server" edition = "2021" readme = "README.md" diff --git a/deltachat-rpc-server/npm-package/package.json b/deltachat-rpc-server/npm-package/package.json index a528d574df..efceac421e 100644 --- a/deltachat-rpc-server/npm-package/package.json +++ b/deltachat-rpc-server/npm-package/package.json @@ -15,5 +15,5 @@ }, "type": "module", "types": "index.d.ts", - "version": "1.142.11" + "version": "1.142.12" } diff --git a/package.json b/package.json index 749d62c5e3..d21e48f03b 100644 --- a/package.json +++ b/package.json @@ -55,5 +55,5 @@ "test:mocha": "mocha node/test/test.mjs --growl --reporter=spec --bail --exit" }, "types": "node/dist/index.d.ts", - "version": "1.142.11" + "version": "1.142.12" } diff --git a/python/pyproject.toml b/python/pyproject.toml index 9e1bdede8b..66eb4510d2 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "deltachat" -version = "1.142.11" +version = "1.142.12" description = "Python bindings for the Delta Chat Core library using CFFI against the Rust-implemented libdeltachat" readme = "README.rst" requires-python = ">=3.7" diff --git a/release-date.in b/release-date.in index d77b3a25b5..825b2baeae 100644 --- a/release-date.in +++ b/release-date.in @@ -1 +1 @@ -2024-08-30 \ No newline at end of file +2024-09-02 \ No newline at end of file diff --git a/src/chat.rs b/src/chat.rs index 09b25bc36e..5dd2bdc6e9 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -279,9 +279,10 @@ impl ChatId { ) -> Result { let chat_id = match ChatIdBlocked::lookup_by_contact(context, contact_id).await? { Some(chat) => { - if create_blocked == Blocked::Not && chat.blocked != Blocked::Not { - chat.id.set_blocked(context, Blocked::Not).await?; + if create_blocked != Blocked::Not || chat.blocked == Blocked::Not { + return Ok(chat.id); } + chat.id.set_blocked(context, Blocked::Not).await?; chat.id } None => { @@ -1954,8 +1955,8 @@ impl Chat { msg.param.set_int(Param::AttachGroupImage, 1); self.param.remove(Param::Unpromoted); self.update_param(context).await?; - // send_sync_msg() is called (usually) a moment later at send_msg_to_smtp() - // when the group creation message is actually sent through SMTP -- + // send_sync_msg() is called a moment later at `smtp::send_smtp_messages()` + // when the group creation message is already in the `smtp` table -- // this makes sure, the other devices are aware of grpid that is used in the sync-message. context .sync_qr_code_tokens(Some(self.id)) @@ -3753,17 +3754,13 @@ pub(crate) async fn add_contact_to_chat_ex( bail!("can not add contact because the account is not part of the group/broadcast"); } + let sync_qr_code_tokens; if from_handshake && chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 { chat.param.remove(Param::Unpromoted); chat.update_param(context).await?; - if context - .sync_qr_code_tokens(Some(chat_id)) - .await - .log_err(context) - .is_ok() - { - context.scheduler.interrupt_smtp().await; - } + sync_qr_code_tokens = true; + } else { + sync_qr_code_tokens = false; } if context.is_self_addr(contact.get_addr()).await? { @@ -3807,6 +3804,15 @@ pub(crate) async fn add_contact_to_chat_ex( return Err(e); } sync = Nosync; + if sync_qr_code_tokens + && context + .sync_qr_code_tokens(Some(chat_id)) + .await + .log_err(context) + .is_ok() + { + context.scheduler.interrupt_smtp().await; + } } context.emit_event(EventType::ChatModified(chat_id)); if sync.into() { diff --git a/src/config.rs b/src/config.rs index 6c8ff10c3a..4bd53a711c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -129,6 +129,7 @@ pub enum Config { /// True if Message Delivery Notifications (read receipts) should /// be sent and requested. + #[strum(props(default = "1"))] MdnsEnabled, /// True if "Sent" folder should be watched for changes. @@ -543,18 +544,15 @@ impl Context { /// Returns whether MDNs should be requested. pub(crate) async fn should_request_mdns(&self) -> Result { - match self.get_config_bool_opt(Config::MdnsEnabled).await? { - Some(val) => Ok(val), - None => Ok(!self.get_config_bool(Config::Bot).await?), + match self.config_exists(Config::MdnsEnabled).await? { + true => self.get_config_bool(Config::MdnsEnabled).await, + false => Ok(!self.get_config_bool(Config::Bot).await?), } } /// Returns whether MDNs should be sent. pub(crate) async fn should_send_mdns(&self) -> Result { - Ok(self - .get_config_bool_opt(Config::MdnsEnabled) - .await? - .unwrap_or(true)) + self.get_config_bool(Config::MdnsEnabled).await } /// Gets configured "delete_server_after" value. @@ -1011,9 +1009,13 @@ mod tests { let t = &TestContext::new_alice().await; assert!(t.should_request_mdns().await?); assert!(t.should_send_mdns().await?); + // The setting should be displayed correctly. + assert!(t.get_config_bool(Config::MdnsEnabled).await?); + t.set_config_bool(Config::Bot, true).await?; assert!(!t.should_request_mdns().await?); assert!(t.should_send_mdns().await?); + assert!(t.get_config_bool(Config::MdnsEnabled).await?); Ok(()) } diff --git a/src/sync.rs b/src/sync.rs index 29ad69c148..a60ec40a0c 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -328,8 +328,10 @@ mod tests { use anyhow::bail; use super::*; + use crate::chat::ProtectionStatus; use crate::chatlist::Chatlist; use crate::contact::{Contact, Origin}; + use crate::securejoin::get_securejoin_qr; use crate::test_utils::{TestContext, TestContextManager}; use crate::tools::SystemTime; @@ -630,4 +632,37 @@ mod tests { assert_eq!(msg.text, "hi"); Ok(()) } + + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_unpromoted_group_no_qr_sync() -> Result<()> { + let mut tcm = TestContextManager::new(); + let alice = &tcm.alice().await; + alice.set_config_bool(Config::SyncMsgs, true).await?; + let alice_chatid = + chat::create_group_chat(alice, ProtectionStatus::Protected, "the chat").await?; + let qr = get_securejoin_qr(alice, Some(alice_chatid)).await?; + let msg_id = alice.send_sync_msg().await?; + assert!(msg_id.is_none()); + + let bob = &tcm.bob().await; + tcm.exec_securejoin_qr(bob, alice, &qr).await; + let msg_id = alice.send_sync_msg().await?; + // The group becomes promoted when Bob joins, so the QR code token is synced. + assert!(msg_id.is_some()); + let sent = alice.pop_sent_msg().await; + let msg = alice.parse_msg(&sent).await; + let mut sync_items = msg.sync_items.unwrap().items; + assert_eq!(sync_items.len(), 1); + let data = sync_items.pop().unwrap().data; + let SyncDataOrUnknown::SyncData(AddQrToken(_)) = data else { + unreachable!(); + }; + + let fiona = &tcm.fiona().await; + tcm.exec_securejoin_qr(fiona, alice, &qr).await; + let msg_id = alice.send_sync_msg().await?; + // The QR code token was already synced before. + assert!(msg_id.is_none()); + Ok(()) + } }