deltachat-rpc-client 1.157.3__py3-none-any.whl → 1.159.0__py3-none-any.whl
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/account.py +10 -5
- deltachat_rpc_client/message.py +4 -0
- deltachat_rpc_client/pytestplugin.py +12 -21
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/METADATA +3 -2
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/RECORD +9 -9
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/WHEEL +1 -1
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/entry_points.txt +0 -0
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info/licenses}/LICENSE +0 -0
- {deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/top_level.txt +0 -0
deltachat_rpc_client/account.py
CHANGED
|
@@ -115,7 +115,7 @@ class Account:
|
|
|
115
115
|
self.start_io()
|
|
116
116
|
self.wait_for_event(EventType.IMAP_INBOX_IDLE)
|
|
117
117
|
|
|
118
|
-
def create_contact(self, obj: Union[int, str, Contact], name: Optional[str] = None) -> Contact:
|
|
118
|
+
def create_contact(self, obj: Union[int, str, Contact, "Account"], name: Optional[str] = None) -> Contact:
|
|
119
119
|
"""Create a new Contact or return an existing one.
|
|
120
120
|
|
|
121
121
|
Calling this method will always result in the same
|
|
@@ -123,9 +123,15 @@ class Account:
|
|
|
123
123
|
with that e-mail address, it is unblocked and its display
|
|
124
124
|
name is updated if specified.
|
|
125
125
|
|
|
126
|
-
:param obj: email-address
|
|
126
|
+
:param obj: email-address, contact id or account.
|
|
127
127
|
:param name: (optional) display name for this contact.
|
|
128
128
|
"""
|
|
129
|
+
if isinstance(obj, Account):
|
|
130
|
+
vcard = obj.self_contact.make_vcard()
|
|
131
|
+
[contact] = self.import_vcard(vcard)
|
|
132
|
+
if name:
|
|
133
|
+
contact.set_name(name)
|
|
134
|
+
return contact
|
|
129
135
|
if isinstance(obj, int):
|
|
130
136
|
obj = Contact(self, obj)
|
|
131
137
|
if isinstance(obj, Contact):
|
|
@@ -146,9 +152,8 @@ class Account:
|
|
|
146
152
|
return [Contact(self, contact_id) for contact_id in contact_ids]
|
|
147
153
|
|
|
148
154
|
def create_chat(self, account: "Account") -> Chat:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return contact.create_chat()
|
|
155
|
+
"""Create a 1:1 chat with another account."""
|
|
156
|
+
return self.create_contact(account).create_chat()
|
|
152
157
|
|
|
153
158
|
def get_device_chat(self) -> Chat:
|
|
154
159
|
"""Return device chat."""
|
deltachat_rpc_client/message.py
CHANGED
|
@@ -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
|
|
|
@@ -12,14 +12,6 @@ from ._utils import futuremethod
|
|
|
12
12
|
from .rpc import Rpc
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def get_temp_credentials() -> dict:
|
|
16
|
-
domain = os.getenv("CHATMAIL_DOMAIN")
|
|
17
|
-
username = "ci-" + "".join(random.choice("2345789acdefghjkmnpqrstuvwxyz") for i in range(6))
|
|
18
|
-
password = f"{username}${username}"
|
|
19
|
-
addr = f"{username}@{domain}"
|
|
20
|
-
return {"email": addr, "password": password}
|
|
21
|
-
|
|
22
|
-
|
|
23
15
|
class ACFactory:
|
|
24
16
|
def __init__(self, deltachat: DeltaChat) -> None:
|
|
25
17
|
self.deltachat = deltachat
|
|
@@ -32,26 +24,25 @@ class ACFactory:
|
|
|
32
24
|
def get_unconfigured_bot(self) -> Bot:
|
|
33
25
|
return Bot(self.get_unconfigured_account())
|
|
34
26
|
|
|
35
|
-
def
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
account.set_config("addr", credentials["email"])
|
|
40
|
-
account.set_config("mail_pw", credentials["password"])
|
|
41
|
-
assert not account.is_configured()
|
|
42
|
-
return account
|
|
27
|
+
def get_credentials(self) -> (str, str):
|
|
28
|
+
domain = os.getenv("CHATMAIL_DOMAIN")
|
|
29
|
+
username = "ci-" + "".join(random.choice("2345789acdefghjkmnpqrstuvwxyz") for i in range(6))
|
|
30
|
+
return f"{username}@{domain}", f"{username}${username}"
|
|
43
31
|
|
|
44
32
|
@futuremethod
|
|
45
33
|
def new_configured_account(self):
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
addr, password = self.get_credentials()
|
|
35
|
+
account = self.get_unconfigured_account()
|
|
36
|
+
params = {"addr": addr, "password": password}
|
|
37
|
+
yield account._rpc.add_transport.future(account.id, params)
|
|
38
|
+
|
|
48
39
|
assert account.is_configured()
|
|
49
40
|
return account
|
|
50
41
|
|
|
51
42
|
def new_configured_bot(self) -> Bot:
|
|
52
|
-
|
|
43
|
+
addr, password = self.get_credentials()
|
|
53
44
|
bot = self.get_unconfigured_bot()
|
|
54
|
-
bot.configure(
|
|
45
|
+
bot.configure(addr, password)
|
|
55
46
|
return bot
|
|
56
47
|
|
|
57
48
|
@futuremethod
|
|
@@ -88,7 +79,7 @@ class ACFactory:
|
|
|
88
79
|
) -> Message:
|
|
89
80
|
if not from_account:
|
|
90
81
|
from_account = (self.get_online_accounts(1))[0]
|
|
91
|
-
to_contact = from_account.create_contact(to_account
|
|
82
|
+
to_contact = from_account.create_contact(to_account)
|
|
92
83
|
if group:
|
|
93
84
|
to_chat = from_account.create_group(group)
|
|
94
85
|
to_chat.add_contact(to_contact)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deltachat-rpc-client
|
|
3
|
-
Version: 1.
|
|
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
|
|
@@ -19,6 +19,7 @@ Classifier: Topic :: Communications :: Email
|
|
|
19
19
|
Requires-Python: >=3.8
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
22
23
|
|
|
23
24
|
# Delta Chat RPC python client
|
|
24
25
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
deltachat_rpc_client/__init__.py,sha256=L19BWnRu9TMF--jQ7e5Asgme951WGsldrTknW86KyTg,566
|
|
2
2
|
deltachat_rpc_client/_utils.py,sha256=pLOV_pxS2MRreLtq-5rnKJp-BP0m8T4LcbJ8N7Xy-D0,6304
|
|
3
|
-
deltachat_rpc_client/account.py,sha256=
|
|
3
|
+
deltachat_rpc_client/account.py,sha256=P4R_DMsVdyWu3qj4q2orwDa273Pg5Z16yivssPU6Eu4,15798
|
|
4
4
|
deltachat_rpc_client/chat.py,sha256=1pbuEBWBjZDD9qQ3U1hY5jozzx0MSs9Ybpw33reA2MU,11208
|
|
5
5
|
deltachat_rpc_client/client.py,sha256=yyXt2USkBeTsqNxtXZNNUqdsPVkqEUHYf7C-5JFmX7s,7043
|
|
6
6
|
deltachat_rpc_client/const.py,sha256=geXY_H-JHn2HLsYPAAWbwnX5LOksU7zqDZh3AOwmUpg,5577
|
|
7
7
|
deltachat_rpc_client/contact.py,sha256=kbqVI93V7-VSCjH8Hfm5M9a62HMnOjBKuw_g6iJN7w8,1966
|
|
8
8
|
deltachat_rpc_client/deltachat.py,sha256=c22_2GX71we6JwQ4yjP-S89mrUYPPbEb3rrPwHHeXt4,1538
|
|
9
9
|
deltachat_rpc_client/events.py,sha256=qYgydsbuWYxQ1PO5ms-D8I5aHpTIiQ6Fg9p23QTvqf0,9877
|
|
10
|
-
deltachat_rpc_client/message.py,sha256=
|
|
10
|
+
deltachat_rpc_client/message.py,sha256=6Jf2WlOp8HOYpjPLXXa_5_rGTg6wVN27PXnF3XIjpGQ,3156
|
|
11
11
|
deltachat_rpc_client/py.typed,sha256=nGQ9Itq-bkXBn5Ri1JIR0oYnDNv7LDRfkowxBSSqVTM,60
|
|
12
|
-
deltachat_rpc_client/pytestplugin.py,sha256=
|
|
12
|
+
deltachat_rpc_client/pytestplugin.py,sha256=SnuGKk06Yd_Dzhy7UpnuetfiPqF9kHV9fsFNlXqvE44,4881
|
|
13
13
|
deltachat_rpc_client/rpc.py,sha256=7RIdyEDwOXU0ACU0LanVqTT1RuIDci5iDr7dNEDE_tE,6554
|
|
14
|
-
deltachat_rpc_client-1.
|
|
15
|
-
deltachat_rpc_client-1.
|
|
16
|
-
deltachat_rpc_client-1.
|
|
17
|
-
deltachat_rpc_client-1.
|
|
18
|
-
deltachat_rpc_client-1.
|
|
19
|
-
deltachat_rpc_client-1.
|
|
14
|
+
deltachat_rpc_client-1.159.0.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
15
|
+
deltachat_rpc_client-1.159.0.dist-info/METADATA,sha256=H-aDCS6HxjWWkNQA6XfaE_FFkj3ATNY4XE_voEKqqOo,2175
|
|
16
|
+
deltachat_rpc_client-1.159.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
17
|
+
deltachat_rpc_client-1.159.0.dist-info/entry_points.txt,sha256=VHpX6EnKBaNj89qJWctApThnMa8suyaamfZEnQacXgc,81
|
|
18
|
+
deltachat_rpc_client-1.159.0.dist-info/top_level.txt,sha256=ePNMkY10htGrLiLydH1ITvYFM3LcTEa51HyPqJ40hDk,21
|
|
19
|
+
deltachat_rpc_client-1.159.0.dist-info/RECORD,,
|
{deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
{deltachat_rpc_client-1.157.3.dist-info → deltachat_rpc_client-1.159.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|