deltachat-rpc-client 1.159.0__tar.gz → 1.159.2__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.159.0/src/deltachat_rpc_client.egg-info → deltachat_rpc_client-1.159.2}/PKG-INFO +1 -1
  2. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/pyproject.toml +1 -1
  3. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/_utils.py +3 -2
  4. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/account.py +11 -0
  5. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/const.py +1 -0
  6. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/pytestplugin.py +1 -1
  7. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2/src/deltachat_rpc_client.egg-info}/PKG-INFO +1 -1
  8. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_account_events.py +1 -1
  9. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_something.py +57 -15
  10. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/LICENSE +0 -0
  11. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/README.md +0 -0
  12. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/setup.cfg +0 -0
  13. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/__init__.py +0 -0
  14. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/chat.py +0 -0
  15. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/client.py +0 -0
  16. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/contact.py +0 -0
  17. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/deltachat.py +0 -0
  18. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/events.py +0 -0
  19. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/message.py +0 -0
  20. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/py.typed +0 -0
  21. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client/rpc.py +0 -0
  22. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client.egg-info/SOURCES.txt +0 -0
  23. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client.egg-info/dependency_links.txt +0 -0
  24. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client.egg-info/entry_points.txt +0 -0
  25. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/src/deltachat_rpc_client.egg-info/top_level.txt +0 -0
  26. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_chatlist_events.py +0 -0
  27. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_iroh_webxdc.py +0 -0
  28. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_key_transfer.py +0 -0
  29. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_multidevice.py +0 -0
  30. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_securejoin.py +0 -0
  31. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_vcard.py +0 -0
  32. {deltachat_rpc_client-1.159.0 → deltachat_rpc_client-1.159.2}/tests/test_webxdc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deltachat-rpc-client
3
- Version: 1.159.0
3
+ Version: 1.159.2
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.159.0"
7
+ version = "1.159.2"
8
8
  description = "Python client for Delta Chat core JSON-RPC interface"
9
9
  classifiers = [
10
10
  "Development Status :: 5 - Production/Stable",
@@ -1,4 +1,5 @@
1
1
  import argparse
2
+ import os
2
3
  import re
3
4
  import sys
4
5
  from threading import Thread
@@ -89,8 +90,8 @@ def _run_cli(
89
90
  help="accounts folder (default: current working directory)",
90
91
  nargs="?",
91
92
  )
92
- parser.add_argument("--email", action="store", help="email address")
93
- parser.add_argument("--password", action="store", help="password")
93
+ parser.add_argument("--email", action="store", help="email address", default=os.getenv("DELTACHAT_EMAIL"))
94
+ parser.add_argument("--password", action="store", help="password", default=os.getenv("DELTACHAT_PASSWORD"))
94
95
  args = parser.parse_args(argv[1:])
95
96
 
96
97
  with Rpc(accounts_dir=args.accounts_dir, **kwargs) as rpc:
@@ -110,6 +110,17 @@ class Account:
110
110
  """Configure an account."""
111
111
  yield self._rpc.configure.future(self.id)
112
112
 
113
+ @futuremethod
114
+ def add_or_update_transport(self, params):
115
+ """Add a new transport."""
116
+ yield self._rpc.add_or_update_transport.future(self.id, params)
117
+
118
+ @futuremethod
119
+ def list_transports(self):
120
+ """Returns the list of all email accounts that are used as a transport in the current profile."""
121
+ transports = yield self._rpc.list_transports.future(self.id)
122
+ return transports
123
+
113
124
  def bring_online(self):
114
125
  """Start I/O and wait until IMAP becomes IDLE."""
115
126
  self.start_io()
@@ -48,6 +48,7 @@ class EventType(str, Enum):
48
48
  MSG_READ = "MsgRead"
49
49
  MSG_DELETED = "MsgDeleted"
50
50
  CHAT_MODIFIED = "ChatModified"
51
+ CHAT_DELETED = "ChatDeleted"
51
52
  CHAT_EPHEMERAL_TIMER_MODIFIED = "ChatEphemeralTimerModified"
52
53
  CONTACTS_CHANGED = "ContactsChanged"
53
54
  LOCATION_CHANGED = "LocationChanged"
@@ -34,7 +34,7 @@ class ACFactory:
34
34
  addr, password = self.get_credentials()
35
35
  account = self.get_unconfigured_account()
36
36
  params = {"addr": addr, "password": password}
37
- yield account._rpc.add_transport.future(account.id, params)
37
+ yield account.add_or_update_transport.future(params)
38
38
 
39
39
  assert account.is_configured()
40
40
  return account
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deltachat-rpc-client
3
- Version: 1.159.0
3
+ Version: 1.159.2
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
@@ -17,7 +17,7 @@ def test_event_on_configuration(acfactory: ACFactory) -> None:
17
17
  account = acfactory.get_unconfigured_account()
18
18
  account.clear_all_events()
19
19
  assert not account.is_configured()
20
- future = account._rpc.add_transport.future(account.id, {"addr": addr, "password": password})
20
+ future = account.add_or_update_transport.future({"addr": addr, "password": password})
21
21
  while True:
22
22
  event = account.wait_for_event()
23
23
  if event.kind == EventType.ACCOUNTS_ITEM_CHANGED:
@@ -63,8 +63,7 @@ def test_acfactory(acfactory) -> None:
63
63
  def test_configure_starttls(acfactory) -> None:
64
64
  addr, password = acfactory.get_credentials()
65
65
  account = acfactory.get_unconfigured_account()
66
- account._rpc.add_transport(
67
- account.id,
66
+ account.add_or_update_transport(
68
67
  {
69
68
  "addr": addr,
70
69
  "password": password,
@@ -75,14 +74,36 @@ def test_configure_starttls(acfactory) -> None:
75
74
  assert account.is_configured()
76
75
 
77
76
 
77
+ def test_lowercase_address(acfactory) -> None:
78
+ addr, password = acfactory.get_credentials()
79
+ addr_upper = addr.upper()
80
+ account = acfactory.get_unconfigured_account()
81
+ account.add_or_update_transport(
82
+ {
83
+ "addr": addr_upper,
84
+ "password": password,
85
+ },
86
+ )
87
+ assert account.is_configured()
88
+ assert addr_upper != addr
89
+ assert account.get_config("configured_addr") == addr
90
+ assert account.list_transports()[0]["addr"] == addr
91
+
92
+ for param in [
93
+ account.get_info()["used_account_settings"],
94
+ account.get_info()["entered_account_settings"],
95
+ ]:
96
+ assert addr in param
97
+ assert addr_upper not in param
98
+
99
+
78
100
  def test_configure_ip(acfactory) -> None:
79
101
  addr, password = acfactory.get_credentials()
80
102
  account = acfactory.get_unconfigured_account()
81
103
  ip_address = socket.gethostbyname(addr.rsplit("@")[-1])
82
104
 
83
105
  with pytest.raises(JsonRpcError):
84
- account._rpc.add_transport(
85
- account.id,
106
+ account.add_or_update_transport(
86
107
  {
87
108
  "addr": addr,
88
109
  "password": password,
@@ -96,8 +117,7 @@ def test_configure_alternative_port(acfactory) -> None:
96
117
  """Test that configuration with alternative port 443 works."""
97
118
  addr, password = acfactory.get_credentials()
98
119
  account = acfactory.get_unconfigured_account()
99
- account._rpc.add_transport(
100
- account.id,
120
+ account.add_or_update_transport(
101
121
  {
102
122
  "addr": addr,
103
123
  "password": password,
@@ -111,15 +131,14 @@ def test_configure_alternative_port(acfactory) -> None:
111
131
  def test_list_transports(acfactory) -> None:
112
132
  addr, password = acfactory.get_credentials()
113
133
  account = acfactory.get_unconfigured_account()
114
- account._rpc.add_transport(
115
- account.id,
134
+ account.add_or_update_transport(
116
135
  {
117
136
  "addr": addr,
118
137
  "password": password,
119
138
  "imapUser": addr,
120
139
  },
121
140
  )
122
- transports = account._rpc.list_transports(account.id)
141
+ transports = account.list_transports()
123
142
  assert len(transports) == 1
124
143
  params = transports[0]
125
144
  assert params["addr"] == addr
@@ -424,7 +443,7 @@ def test_wait_next_messages(acfactory) -> None:
424
443
  addr, password = acfactory.get_credentials()
425
444
  bot = acfactory.get_unconfigured_account()
426
445
  bot.set_config("bot", "1")
427
- bot._rpc.add_transport(bot.id, {"addr": addr, "password": password})
446
+ bot.add_or_update_transport({"addr": addr, "password": password})
428
447
  assert bot.is_configured()
429
448
 
430
449
  # There are no old messages and the call returns immediately.
@@ -607,7 +626,7 @@ def test_reactions_for_a_reordering_move(acfactory, direct_imap):
607
626
 
608
627
  addr, password = acfactory.get_credentials()
609
628
  ac2 = acfactory.get_unconfigured_account()
610
- ac2._rpc.add_transport(ac2.id, {"addr": addr, "password": password})
629
+ ac2.add_or_update_transport({"addr": addr, "password": password})
611
630
  ac2.set_config("mvbox_move", "1")
612
631
  assert ac2.is_configured()
613
632
 
@@ -717,12 +736,11 @@ def test_get_http_response(acfactory):
717
736
 
718
737
  def test_configured_imap_certificate_checks(acfactory):
719
738
  alice = acfactory.new_configured_account()
720
- configured_certificate_checks = alice.get_config("configured_imap_certificate_checks")
721
739
 
722
740
  # Certificate checks should be configured (not None)
723
- assert configured_certificate_checks
741
+ assert "cert_automatic" in alice.get_info().used_account_settings
724
742
 
725
- # 0 is the value old Delta Chat core versions used
743
+ # "cert_old_automatic" is the value old Delta Chat core versions used
726
744
  # to mean user entered "imap_certificate_checks=0" (Automatic)
727
745
  # and configuration failed to use strict TLS checks
728
746
  # so it switched strict TLS checks off.
@@ -733,7 +751,7 @@ def test_configured_imap_certificate_checks(acfactory):
733
751
  #
734
752
  # Core 1.142.4, 1.142.5 and 1.142.6 saved this value due to bug.
735
753
  # This test is a regression test to prevent this happening again.
736
- assert configured_certificate_checks != "0"
754
+ assert "cert_old_automatic" not in alice.get_info().used_account_settings
737
755
 
738
756
 
739
757
  def test_no_old_msg_is_fresh(acfactory):
@@ -805,3 +823,27 @@ def test_get_all_accounts_deadlock(rpc):
805
823
  all_accounts = rpc.get_all_accounts.future()
806
824
  rpc.add_account()
807
825
  all_accounts()
826
+
827
+
828
+ def test_delete_deltachat_folder(acfactory, direct_imap):
829
+ """Test that DeltaChat folder is recreated if user deletes it manually."""
830
+ ac1 = acfactory.new_configured_account()
831
+ ac1.set_config("mvbox_move", "1")
832
+ ac1.bring_online()
833
+
834
+ ac1_direct_imap = direct_imap(ac1)
835
+ ac1_direct_imap.conn.folder.delete("DeltaChat")
836
+ assert "DeltaChat" not in ac1_direct_imap.list_folders()
837
+
838
+ # Wait until new folder is created and UIDVALIDITY is updated.
839
+ while True:
840
+ event = ac1.wait_for_event()
841
+ if event.kind == EventType.INFO and "uid/validity change folder DeltaChat" in event.msg:
842
+ break
843
+
844
+ ac2 = acfactory.get_online_account()
845
+ ac2.create_chat(ac1).send_text("hello")
846
+ msg = ac1.wait_for_incoming_msg().get_snapshot()
847
+ assert msg.text == "hello"
848
+
849
+ assert "DeltaChat" in ac1_direct_imap.list_folders()