From 9c812bb5ab4cbfb198d7357a0e08171e0253f46a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 6 Jul 2025 17:29:14 +0000 Subject: [PATCH 1/4] api(deltachat-rpc-client): add Message.get_read_receipts() --- deltachat-rpc-client/src/deltachat_rpc_client/message.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/message.py b/deltachat-rpc-client/src/deltachat_rpc_client/message.py index bc35ffc62e..4fbad3975c 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/message.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/message.py @@ -2,7 +2,7 @@ import json from dataclasses import dataclass -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, List, Optional, Union from ._utils import AttrDict, futuremethod from .const import EventType @@ -39,6 +39,11 @@ def get_snapshot(self) -> AttrDict: snapshot["message"] = self return snapshot + def get_read_receipts(self) -> List[AttrDict]: + """Get message read receipts.""" + read_receipts = self._rpc.get_message_read_receipts(self.account.id, self.id) + return [AttrDict(read_receipt) for read_receipt in read_receipts] + def get_reactions(self) -> Optional[AttrDict]: """Get message reactions.""" reactions = self._rpc.get_message_reactions(self.account.id, self.id) From 377227c39ca2af87b24afa8881a1bf7f7a3fe05c Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 6 Jul 2025 18:02:48 +0000 Subject: [PATCH 2/4] fix: send Autocrypt header in MDNs Otherwise MDNs are attributed to address-contacts rather than key-contacts. --- src/mimefactory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 4aa9676689..8fdfff2824 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -528,7 +528,7 @@ impl MimeFactory { Loaded::Message { msg, .. } => { msg.param.get_bool(Param::SkipAutocrypt).unwrap_or_default() } - Loaded::Mdn { .. } => true, + Loaded::Mdn { .. } => false, } } From fd08fa091a5eb139d5004a1712fe2da49377fb63 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 6 Jul 2025 17:29:14 +0000 Subject: [PATCH 3/4] test: add online test for read receipts --- deltachat-rpc-client/tests/test_something.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deltachat-rpc-client/tests/test_something.py b/deltachat-rpc-client/tests/test_something.py index 35a8e0a362..01b1c37ea1 100644 --- a/deltachat-rpc-client/tests/test_something.py +++ b/deltachat-rpc-client/tests/test_something.py @@ -726,6 +726,26 @@ def test_markseen_contact_request(acfactory): assert message2.get_snapshot().state == MessageState.IN_SEEN +def test_read_receipt(acfactory): + """ + Test sending a read receipt and ensure it is attributed to the correct contact. + """ + alice, bob = acfactory.get_online_accounts(2) + + alice_chat_bob = alice.create_chat(bob) + alice_contact_bob = alice.create_contact(bob) + bob.create_chat(alice) # Accept the chat + + alice_chat_bob.send_text("Hello Bob!") + msg = bob.wait_for_incoming_msg() + msg.mark_seen() + + read_msg = alice.get_message_by_id(alice.wait_for_event(EventType.MSG_READ).msg_id) + read_receipts = read_msg.get_read_receipts() + assert len(read_receipts) == 1 + assert read_receipts[0].contact_id == alice_contact_bob.id + + def test_get_http_response(acfactory): alice = acfactory.new_configured_account() http_response = alice._rpc.get_http_response(alice.id, "https://example.org") From c7cecd14abbc16f1389558f4eb39b21c1b274d1a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 6 Jul 2025 22:06:54 +0000 Subject: [PATCH 4/4] docs: remove outdated comment that says MDNs are unencrypted --- src/mimefactory.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 8fdfff2824..f130cd67a4 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1712,16 +1712,6 @@ impl MimeFactory { fn render_mdn(&mut self) -> Result> { // RFC 6522, this also requires the `report-type` parameter which is equal // to the MIME subtype of the second body part of the multipart/report - // - // currently, we do not send MDNs encrypted: - // - in a multi-device-setup that is not set up properly, MDNs would disturb the communication as they - // are send automatically which may lead to spreading outdated Autocrypt headers. - // - they do not carry any information but the Message-ID - // - this save some KB - // - in older versions, we did not encrypt messages to ourself when they to to SMTP - however, if these messages - // are forwarded for any reasons (eg. gmail always forwards to IMAP), we have no chance to decrypt them; - // this issue is fixed with 0.9.4 - let Loaded::Mdn { rfc724_mid, additional_msg_ids,