deltachat-rpc-client 1.155.6__tar.gz → 1.156.1__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.
- {deltachat_rpc_client-1.155.6/src/deltachat_rpc_client.egg-info → deltachat_rpc_client-1.156.1}/PKG-INFO +1 -1
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/pyproject.toml +1 -1
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/account.py +11 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/chat.py +4 -1
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/message.py +3 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1/src/deltachat_rpc_client.egg-info}/PKG-INFO +1 -1
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client.egg-info/SOURCES.txt +1 -0
- deltachat_rpc_client-1.156.1/tests/test_key_transfer.py +50 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_securejoin.py +13 -6
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_something.py +38 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/LICENSE +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/README.md +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/setup.cfg +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/__init__.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/_utils.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/client.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/const.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/contact.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/deltachat.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/events.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/py.typed +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/pytestplugin.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/rpc.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client.egg-info/dependency_links.txt +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client.egg-info/entry_points.txt +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client.egg-info/top_level.txt +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_account_events.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_chatlist_events.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_iroh_webxdc.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_vcard.py +0 -0
- {deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/tests/test_webxdc.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deltachat-rpc-client"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.156.1"
|
|
8
8
|
description = "Python client for Delta Chat core JSON-RPC interface"
|
|
9
9
|
classifiers = [
|
|
10
10
|
"Development Status :: 5 - Production/Stable",
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/account.py
RENAMED
|
@@ -301,6 +301,13 @@ class Account:
|
|
|
301
301
|
if event.kind == EventType.INCOMING_MSG:
|
|
302
302
|
return event
|
|
303
303
|
|
|
304
|
+
def wait_for_msgs_changed_event(self):
|
|
305
|
+
"""Wait for messages changed event and return it."""
|
|
306
|
+
while True:
|
|
307
|
+
event = self.wait_for_event()
|
|
308
|
+
if event.kind == EventType.MSGS_CHANGED:
|
|
309
|
+
return event
|
|
310
|
+
|
|
304
311
|
def wait_for_incoming_msg(self):
|
|
305
312
|
"""Wait for incoming message and return it.
|
|
306
313
|
|
|
@@ -352,3 +359,7 @@ class Account:
|
|
|
352
359
|
"""Import keys."""
|
|
353
360
|
passphrase = "" # Importing passphrase-protected keys is currently not supported.
|
|
354
361
|
self._rpc.import_self_keys(self.id, str(path), passphrase)
|
|
362
|
+
|
|
363
|
+
def initiate_autocrypt_key_transfer(self) -> None:
|
|
364
|
+
"""Send Autocrypt Setup Message."""
|
|
365
|
+
return self._rpc.initiate_autocrypt_key_transfer(self.id)
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/chat.py
RENAMED
|
@@ -124,6 +124,7 @@ class Chat:
|
|
|
124
124
|
html: Optional[str] = None,
|
|
125
125
|
viewtype: Optional[ViewType] = None,
|
|
126
126
|
file: Optional[str] = None,
|
|
127
|
+
filename: Optional[str] = None,
|
|
127
128
|
location: Optional[tuple[float, float]] = None,
|
|
128
129
|
override_sender_name: Optional[str] = None,
|
|
129
130
|
quoted_msg: Optional[Union[int, Message]] = None,
|
|
@@ -137,6 +138,7 @@ class Chat:
|
|
|
137
138
|
"html": html,
|
|
138
139
|
"viewtype": viewtype,
|
|
139
140
|
"file": file,
|
|
141
|
+
"filename": filename,
|
|
140
142
|
"location": location,
|
|
141
143
|
"overrideSenderName": override_sender_name,
|
|
142
144
|
"quotedMessageId": quoted_msg,
|
|
@@ -172,13 +174,14 @@ class Chat:
|
|
|
172
174
|
self,
|
|
173
175
|
text: Optional[str] = None,
|
|
174
176
|
file: Optional[str] = None,
|
|
177
|
+
filename: Optional[str] = None,
|
|
175
178
|
quoted_msg: Optional[int] = None,
|
|
176
179
|
viewtype: Optional[str] = None,
|
|
177
180
|
) -> None:
|
|
178
181
|
"""Set draft message."""
|
|
179
182
|
if isinstance(quoted_msg, Message):
|
|
180
183
|
quoted_msg = quoted_msg.id
|
|
181
|
-
self._rpc.misc_set_draft(self.account.id, self.id, text, file, quoted_msg, viewtype)
|
|
184
|
+
self._rpc.misc_set_draft(self.account.id, self.id, text, file, filename, quoted_msg, viewtype)
|
|
182
185
|
|
|
183
186
|
def remove_draft(self) -> None:
|
|
184
187
|
"""Remove draft message."""
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/message.py
RENAMED
|
@@ -52,6 +52,9 @@ class Message:
|
|
|
52
52
|
"""Mark the message as seen."""
|
|
53
53
|
self._rpc.markseen_msgs(self.account.id, [self.id])
|
|
54
54
|
|
|
55
|
+
def continue_autocrypt_key_transfer(self, setup_code: str) -> None:
|
|
56
|
+
self._rpc.continue_autocrypt_key_transfer(self.account.id, self.id, setup_code)
|
|
57
|
+
|
|
55
58
|
def send_webxdc_status_update(self, update: Union[dict, str], description: str) -> None:
|
|
56
59
|
"""Send a webxdc status update. This message must be a webxdc."""
|
|
57
60
|
if not isinstance(update, str):
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from deltachat_rpc_client import EventType
|
|
4
|
+
from deltachat_rpc_client.rpc import JsonRpcError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def wait_for_autocrypt_setup_message(account):
|
|
8
|
+
while True:
|
|
9
|
+
event = account.wait_for_event()
|
|
10
|
+
if event.kind == EventType.MSGS_CHANGED and event.msg_id != 0:
|
|
11
|
+
msg_id = event.msg_id
|
|
12
|
+
msg = account.get_message_by_id(msg_id)
|
|
13
|
+
if msg.get_snapshot().is_setupmessage:
|
|
14
|
+
return msg
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_autocrypt_setup_message_key_transfer(acfactory):
|
|
18
|
+
alice1 = acfactory.get_online_account()
|
|
19
|
+
|
|
20
|
+
alice2 = acfactory.get_unconfigured_account()
|
|
21
|
+
alice2.set_config("addr", alice1.get_config("addr"))
|
|
22
|
+
alice2.set_config("mail_pw", alice1.get_config("mail_pw"))
|
|
23
|
+
alice2.configure()
|
|
24
|
+
|
|
25
|
+
setup_code = alice1.initiate_autocrypt_key_transfer()
|
|
26
|
+
msg = wait_for_autocrypt_setup_message(alice2)
|
|
27
|
+
|
|
28
|
+
# Test that entering wrong code returns an error.
|
|
29
|
+
with pytest.raises(JsonRpcError):
|
|
30
|
+
msg.continue_autocrypt_key_transfer("7037-0673-6287-3013-4095-7956-5617-6806-6756")
|
|
31
|
+
|
|
32
|
+
msg.continue_autocrypt_key_transfer(setup_code)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_ac_setup_message_twice(acfactory):
|
|
36
|
+
alice1 = acfactory.get_online_account()
|
|
37
|
+
alice2 = acfactory.get_unconfigured_account()
|
|
38
|
+
alice2.set_config("addr", alice1.get_config("addr"))
|
|
39
|
+
alice2.set_config("mail_pw", alice1.get_config("mail_pw"))
|
|
40
|
+
alice2.configure()
|
|
41
|
+
|
|
42
|
+
# Send the first Autocrypt Setup Message and ignore it.
|
|
43
|
+
_setup_code = alice1.initiate_autocrypt_key_transfer()
|
|
44
|
+
wait_for_autocrypt_setup_message(alice2)
|
|
45
|
+
|
|
46
|
+
# Send the second Autocrypt Setup Message and import it.
|
|
47
|
+
setup_code = alice1.initiate_autocrypt_key_transfer()
|
|
48
|
+
msg = wait_for_autocrypt_setup_message(alice2)
|
|
49
|
+
|
|
50
|
+
msg.continue_autocrypt_key_transfer(setup_code)
|
|
@@ -4,6 +4,7 @@ import time
|
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
6
|
from deltachat_rpc_client import Chat, EventType, SpecialContactId
|
|
7
|
+
from deltachat_rpc_client.rpc import JsonRpcError
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def test_qr_setup_contact(acfactory, tmp_path) -> None:
|
|
@@ -26,17 +27,21 @@ def test_qr_setup_contact(acfactory, tmp_path) -> None:
|
|
|
26
27
|
bob_contact_alice_snapshot = bob_contact_alice.get_snapshot()
|
|
27
28
|
assert bob_contact_alice_snapshot.is_verified
|
|
28
29
|
|
|
29
|
-
# Test that if Bob
|
|
30
|
+
# Test that if Bob imports a key,
|
|
31
|
+
# backwards verification is not lost
|
|
32
|
+
# because default key is not changed.
|
|
30
33
|
logging.info("Bob 2 is created")
|
|
31
34
|
bob2 = acfactory.new_configured_account()
|
|
32
35
|
bob2.export_self_keys(tmp_path)
|
|
33
36
|
|
|
34
|
-
logging.info("Bob
|
|
35
|
-
|
|
37
|
+
logging.info("Bob tries to import a key")
|
|
38
|
+
# Importing a second key is not allowed.
|
|
39
|
+
with pytest.raises(JsonRpcError):
|
|
40
|
+
bob.import_self_keys(tmp_path)
|
|
36
41
|
|
|
37
|
-
assert bob.get_config("key_id") == "
|
|
42
|
+
assert bob.get_config("key_id") == "1"
|
|
38
43
|
bob_contact_alice_snapshot = bob_contact_alice.get_snapshot()
|
|
39
|
-
assert
|
|
44
|
+
assert bob_contact_alice_snapshot.is_verified
|
|
40
45
|
|
|
41
46
|
|
|
42
47
|
def test_qr_setup_contact_svg(acfactory) -> None:
|
|
@@ -653,12 +658,14 @@ def test_withdraw_securejoin_qr(acfactory):
|
|
|
653
658
|
bob_chat = bob.secure_join(qr_code)
|
|
654
659
|
bob.wait_for_securejoin_joiner_success()
|
|
655
660
|
|
|
661
|
+
alice.clear_all_events()
|
|
662
|
+
|
|
656
663
|
snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
|
657
664
|
assert snapshot.text == "Member Me ({}) added by {}.".format(bob.get_config("addr"), alice.get_config("addr"))
|
|
658
665
|
assert snapshot.chat.get_basic_snapshot().is_protected
|
|
659
666
|
bob_chat.leave()
|
|
660
667
|
|
|
661
|
-
snapshot = alice.get_message_by_id(alice.
|
|
668
|
+
snapshot = alice.get_message_by_id(alice.wait_for_msgs_changed_event().msg_id).get_snapshot()
|
|
662
669
|
assert snapshot.text == "Group left by {}.".format(bob.get_config("addr"))
|
|
663
670
|
|
|
664
671
|
logging.info("Alice withdraws QR code.")
|
|
@@ -287,6 +287,44 @@ def test_message(acfactory) -> None:
|
|
|
287
287
|
assert reactions == snapshot.reactions
|
|
288
288
|
|
|
289
289
|
|
|
290
|
+
def test_reaction_seen_on_another_dev(acfactory, tmp_path) -> None:
|
|
291
|
+
alice, bob = acfactory.get_online_accounts(2)
|
|
292
|
+
alice.export_backup(tmp_path)
|
|
293
|
+
files = list(tmp_path.glob("*.tar"))
|
|
294
|
+
alice2 = acfactory.get_unconfigured_account()
|
|
295
|
+
alice2.import_backup(files[0])
|
|
296
|
+
alice2.start_io()
|
|
297
|
+
|
|
298
|
+
bob_addr = bob.get_config("addr")
|
|
299
|
+
alice_contact_bob = alice.create_contact(bob_addr, "Bob")
|
|
300
|
+
alice_chat_bob = alice_contact_bob.create_chat()
|
|
301
|
+
alice_chat_bob.send_text("Hello!")
|
|
302
|
+
|
|
303
|
+
event = bob.wait_for_incoming_msg_event()
|
|
304
|
+
msg_id = event.msg_id
|
|
305
|
+
|
|
306
|
+
message = bob.get_message_by_id(msg_id)
|
|
307
|
+
snapshot = message.get_snapshot()
|
|
308
|
+
snapshot.chat.accept()
|
|
309
|
+
message.send_reaction("😎")
|
|
310
|
+
for a in [alice, alice2]:
|
|
311
|
+
while True:
|
|
312
|
+
event = a.wait_for_event()
|
|
313
|
+
if event.kind == EventType.INCOMING_REACTION:
|
|
314
|
+
break
|
|
315
|
+
|
|
316
|
+
alice2.clear_all_events()
|
|
317
|
+
alice_chat_bob.mark_noticed()
|
|
318
|
+
while True:
|
|
319
|
+
event = alice2.wait_for_event()
|
|
320
|
+
if event.kind == EventType.MSGS_NOTICED:
|
|
321
|
+
chat_id = event.chat_id
|
|
322
|
+
break
|
|
323
|
+
alice2_contact_bob = alice2.get_contact_by_addr(bob_addr)
|
|
324
|
+
alice2_chat_bob = alice2_contact_bob.create_chat()
|
|
325
|
+
assert chat_id == alice2_chat_bob.id
|
|
326
|
+
|
|
327
|
+
|
|
290
328
|
def test_is_bot(acfactory) -> None:
|
|
291
329
|
"""Test that we can recognize messages submitted by bots."""
|
|
292
330
|
alice, bob = acfactory.get_online_accounts(2)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/__init__.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/_utils.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/client.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/const.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/contact.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/deltachat.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/events.py
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{deltachat_rpc_client-1.155.6 → deltachat_rpc_client-1.156.1}/src/deltachat_rpc_client/rpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|