deltachat-rpc-client 1.158.0__tar.gz → 1.159.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {deltachat_rpc_client-1.158.0/src/deltachat_rpc_client.egg-info → deltachat_rpc_client-1.159.0}/PKG-INFO +1 -1
  2. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/pyproject.toml +1 -1
  3. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/message.py +4 -0
  4. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/pytestplugin.py +1 -1
  5. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0/src/deltachat_rpc_client.egg-info}/PKG-INFO +1 -1
  6. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client.egg-info/SOURCES.txt +1 -0
  7. deltachat_rpc_client-1.159.0/tests/test_multidevice.py +110 -0
  8. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_securejoin.py +3 -3
  9. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_something.py +8 -0
  10. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_vcard.py +1 -2
  11. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_webxdc.py +2 -4
  12. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/LICENSE +0 -0
  13. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/README.md +0 -0
  14. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/setup.cfg +0 -0
  15. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/__init__.py +0 -0
  16. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/_utils.py +0 -0
  17. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/account.py +0 -0
  18. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/chat.py +0 -0
  19. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/client.py +0 -0
  20. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/const.py +0 -0
  21. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/contact.py +0 -0
  22. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/deltachat.py +0 -0
  23. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/events.py +0 -0
  24. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/py.typed +0 -0
  25. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client/rpc.py +0 -0
  26. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client.egg-info/dependency_links.txt +0 -0
  27. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client.egg-info/entry_points.txt +0 -0
  28. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/src/deltachat_rpc_client.egg-info/top_level.txt +0 -0
  29. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_account_events.py +0 -0
  30. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_chatlist_events.py +0 -0
  31. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_iroh_webxdc.py +0 -0
  32. {deltachat_rpc_client-1.158.0 → deltachat_rpc_client-1.159.0}/tests/test_key_transfer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deltachat-rpc-client
3
- Version: 1.158.0
3
+ Version: 1.159.0
4
4
  Summary: Python client for Delta Chat core JSON-RPC interface
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: Intended Audience :: Developers
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deltachat-rpc-client"
7
- version = "1.158.0"
7
+ version = "1.159.0"
8
8
  description = "Python client for Delta Chat core JSON-RPC interface"
9
9
  classifiers = [
10
10
  "Development Status :: 5 - Production/Stable",
@@ -64,6 +64,10 @@ class Message:
64
64
  def get_webxdc_status_updates(self, last_known_serial: int = 0) -> list:
65
65
  return json.loads(self._rpc.get_webxdc_status_updates(self.account.id, self.id, last_known_serial))
66
66
 
67
+ def get_info(self) -> str:
68
+ """Return message info."""
69
+ return self._rpc.get_message_info(self.account.id, self.id)
70
+
67
71
  def get_webxdc_info(self) -> dict:
68
72
  return self._rpc.get_webxdc_info(self.account.id, self.id)
69
73
 
@@ -79,7 +79,7 @@ class ACFactory:
79
79
  ) -> Message:
80
80
  if not from_account:
81
81
  from_account = (self.get_online_accounts(1))[0]
82
- to_contact = from_account.create_contact(to_account.get_config("addr"))
82
+ to_contact = from_account.create_contact(to_account)
83
83
  if group:
84
84
  to_chat = from_account.create_group(group)
85
85
  to_chat.add_contact(to_contact)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deltachat-rpc-client
3
- Version: 1.158.0
3
+ Version: 1.159.0
4
4
  Summary: Python client for Delta Chat core JSON-RPC interface
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: Intended Audience :: Developers
@@ -23,6 +23,7 @@ tests/test_account_events.py
23
23
  tests/test_chatlist_events.py
24
24
  tests/test_iroh_webxdc.py
25
25
  tests/test_key_transfer.py
26
+ tests/test_multidevice.py
26
27
  tests/test_securejoin.py
27
28
  tests/test_something.py
28
29
  tests/test_vcard.py
@@ -0,0 +1,110 @@
1
+ from imap_tools import AND
2
+
3
+ from deltachat_rpc_client import EventType
4
+ from deltachat_rpc_client.const import MessageState
5
+
6
+
7
+ def test_one_account_send_bcc_setting(acfactory, log, direct_imap):
8
+ ac1, ac2 = acfactory.get_online_accounts(2)
9
+ ac1_clone = ac1.clone()
10
+ ac1_clone.bring_online()
11
+
12
+ log.section("send out message without bcc to ourselves")
13
+ ac1.set_config("bcc_self", "0")
14
+ chat = ac1.create_chat(ac2)
15
+ self_addr = ac1.get_config("addr")
16
+ other_addr = ac2.get_config("addr")
17
+
18
+ msg_out = chat.send_text("message1")
19
+ assert not msg_out.get_snapshot().is_forwarded
20
+
21
+ # wait for send out (no BCC)
22
+ ev = ac1.wait_for_event(EventType.SMTP_MESSAGE_SENT)
23
+ assert ac1.get_config("bcc_self") == "0"
24
+
25
+ assert self_addr not in ev.msg
26
+ assert other_addr in ev.msg
27
+
28
+ log.section("ac1: setting bcc_self=1")
29
+ ac1.set_config("bcc_self", "1")
30
+
31
+ log.section("send out message with bcc to ourselves")
32
+ msg_out = chat.send_text("message2")
33
+
34
+ # wait for send out (BCC)
35
+ ev = ac1.wait_for_event(EventType.SMTP_MESSAGE_SENT)
36
+ assert ac1.get_config("bcc_self") == "1"
37
+
38
+ # Second client receives only second message, but not the first.
39
+ ev_msg = ac1_clone.wait_for_event(EventType.MSGS_CHANGED)
40
+ assert ac1_clone.get_message_by_id(ev_msg.msg_id).get_snapshot().text == msg_out.get_snapshot().text
41
+
42
+ # now make sure we are sending message to ourselves too
43
+ assert self_addr in ev.msg
44
+ assert self_addr in ev.msg
45
+
46
+ # BCC-self messages are marked as seen by the sender device.
47
+ while True:
48
+ event = ac1.wait_for_event()
49
+ if event.kind == EventType.INFO and event.msg.endswith("Marked messages 1 in folder INBOX as seen."):
50
+ break
51
+
52
+ # Check that the message is marked as seen on IMAP.
53
+ ac1_direct_imap = direct_imap(ac1)
54
+ ac1_direct_imap.connect()
55
+ ac1_direct_imap.select_folder("Inbox")
56
+ assert len(list(ac1_direct_imap.conn.fetch(AND(seen=True)))) == 1
57
+
58
+
59
+ def test_multidevice_sync_seen(acfactory, log):
60
+ """Test that message marked as seen on one device is marked as seen on another."""
61
+ ac1, ac2 = acfactory.get_online_accounts(2)
62
+ ac1_clone = ac1.clone()
63
+ ac1_clone.bring_online()
64
+
65
+ ac1.set_config("bcc_self", "1")
66
+ ac1_clone.set_config("bcc_self", "1")
67
+
68
+ ac1_chat = ac1.create_chat(ac2)
69
+ ac1_clone_chat = ac1_clone.create_chat(ac2)
70
+ ac2_chat = ac2.create_chat(ac1)
71
+
72
+ log.section("Send a message from ac2 to ac1 and check that it's 'fresh'")
73
+ ac2_chat.send_text("Hi")
74
+ ac1_message = ac1.wait_for_incoming_msg()
75
+ ac1_clone_message = ac1_clone.wait_for_incoming_msg()
76
+ assert ac1_chat.get_fresh_message_count() == 1
77
+ assert ac1_clone_chat.get_fresh_message_count() == 1
78
+ assert ac1_message.get_snapshot().state == MessageState.IN_FRESH
79
+ assert ac1_clone_message.get_snapshot().state == MessageState.IN_FRESH
80
+
81
+ log.section("ac1 marks message as seen on the first device")
82
+ ac1.mark_seen_messages([ac1_message])
83
+ assert ac1_message.get_snapshot().state == MessageState.IN_SEEN
84
+
85
+ log.section("ac1 clone detects that message is marked as seen")
86
+ ev = ac1_clone.wait_for_event(EventType.MSGS_NOTICED)
87
+ assert ev.chat_id == ac1_clone_chat.id
88
+
89
+ log.section("Send an ephemeral message from ac2 to ac1")
90
+ ac2_chat.set_ephemeral_timer(60)
91
+ ac1.wait_for_event(EventType.CHAT_EPHEMERAL_TIMER_MODIFIED)
92
+ ac1.wait_for_incoming_msg()
93
+ ac1_clone.wait_for_event(EventType.CHAT_EPHEMERAL_TIMER_MODIFIED)
94
+ ac1_clone.wait_for_incoming_msg()
95
+
96
+ ac2_chat.send_text("Foobar")
97
+ ac1_message = ac1.wait_for_incoming_msg()
98
+ ac1_clone_message = ac1_clone.wait_for_incoming_msg()
99
+ assert "Ephemeral timer: 60\n" in ac1_message.get_info()
100
+ assert "Expires: " not in ac1_clone_message.get_info()
101
+ assert "Ephemeral timer: 60\n" in ac1_message.get_info()
102
+ assert "Expires: " not in ac1_clone_message.get_info()
103
+
104
+ ac1_message.mark_seen()
105
+ assert "Expires: " in ac1_message.get_info()
106
+ ev = ac1_clone.wait_for_event(EventType.MSGS_NOTICED)
107
+ assert ev.chat_id == ac1_clone_chat.id
108
+ assert ac1_clone_message.get_snapshot().state == MessageState.IN_SEEN
109
+ # Test that the timer is started on the second device after synchronizing the seen status.
110
+ assert "Expires: " in ac1_clone_message.get_info()
@@ -89,7 +89,7 @@ def test_qr_securejoin(acfactory, protect):
89
89
  assert alice_contact_bob_snapshot.is_verified
90
90
 
91
91
  snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot()
92
- assert snapshot.text == "Member Me ({}) added by {}.".format(bob.get_config("addr"), alice.get_config("addr"))
92
+ assert snapshot.text == "Member Me added by {}.".format(alice.get_config("addr"))
93
93
  assert snapshot.chat.get_basic_snapshot().is_protected == protect
94
94
 
95
95
  # Test that Bob verified Alice's profile.
@@ -563,7 +563,7 @@ def test_securejoin_after_contact_resetup(acfactory) -> None:
563
563
 
564
564
  # ac1 waits for member added message and creates a QR code.
565
565
  snapshot = ac1.get_message_by_id(ac1.wait_for_incoming_msg_event().msg_id).get_snapshot()
566
- assert snapshot.text == "Member Me ({}) added by {}.".format(ac1.get_config("addr"), ac3.get_config("addr"))
566
+ assert snapshot.text == "Member Me added by {}.".format(ac3.get_config("addr"))
567
567
  ac1_qr_code = snapshot.chat.get_qr_code()
568
568
 
569
569
  # ac2 verifies ac1
@@ -646,7 +646,7 @@ def test_withdraw_securejoin_qr(acfactory):
646
646
  alice.clear_all_events()
647
647
 
648
648
  snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot()
649
- assert snapshot.text == "Member Me ({}) added by {}.".format(bob.get_config("addr"), alice.get_config("addr"))
649
+ assert snapshot.text == "Member Me added by {}.".format(alice.get_config("addr"))
650
650
  assert snapshot.chat.get_basic_snapshot().is_protected
651
651
  bob_chat.leave()
652
652
 
@@ -797,3 +797,11 @@ def test_rename_group(acfactory):
797
797
  alice_group.set_name(name)
798
798
  bob.wait_for_incoming_msg_event()
799
799
  assert bob_chat.get_basic_snapshot().name == name
800
+
801
+
802
+ def test_get_all_accounts_deadlock(rpc):
803
+ """Regression test for get_all_accounts deadlock."""
804
+ for _ in range(100):
805
+ all_accounts = rpc.get_all_accounts.future()
806
+ rpc.add_account()
807
+ all_accounts()
@@ -1,8 +1,7 @@
1
1
  def test_vcard(acfactory) -> None:
2
2
  alice, bob = acfactory.get_online_accounts(2)
3
3
 
4
- bob_addr = bob.get_config("addr")
5
- alice_contact_bob = alice.create_contact(bob_addr, "Bob")
4
+ alice_contact_bob = alice.create_contact(bob, "Bob")
6
5
  alice_contact_charlie = alice.create_contact("charlie@example.org", "Charlie")
7
6
 
8
7
  alice_chat_bob = alice_contact_bob.create_chat()
@@ -1,8 +1,7 @@
1
1
  def test_webxdc(acfactory) -> None:
2
2
  alice, bob = acfactory.get_online_accounts(2)
3
3
 
4
- bob_addr = bob.get_config("addr")
5
- alice_contact_bob = alice.create_contact(bob_addr, "Bob")
4
+ alice_contact_bob = alice.create_contact(bob, "Bob")
6
5
  alice_chat_bob = alice_contact_bob.create_chat()
7
6
  alice_chat_bob.send_message(text="Let's play chess!", file="../test-data/webxdc/chess.xdc")
8
7
 
@@ -45,8 +44,7 @@ def test_webxdc(acfactory) -> None:
45
44
  def test_webxdc_insert_lots_of_updates(acfactory) -> None:
46
45
  alice, bob = acfactory.get_online_accounts(2)
47
46
 
48
- bob_addr = bob.get_config("addr")
49
- alice_contact_bob = alice.create_contact(bob_addr, "Bob")
47
+ alice_contact_bob = alice.create_contact(bob, "Bob")
50
48
  alice_chat_bob = alice_contact_bob.create_chat()
51
49
  message = alice_chat_bob.send_message(text="Let's play chess!", file="../test-data/webxdc/chess.xdc")
52
50