Skip to content

Commit 66df0d2

Browse files
committed
api: Deprecate old server config keys that were replaced by add_or_update_transport()
1 parent 5a6b1c6 commit 66df0d2

2 files changed

Lines changed: 113 additions & 24 deletions

File tree

deltachat-ffi/deltachat.h

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -390,26 +390,9 @@ char* dc_get_blobdir (const dc_context_t* context);
390390
/**
391391
* Configure the context. The configuration is handled by key=value pairs as:
392392
*
393-
* - `addr` = Email address to use for configuration.
394-
* If dc_configure() fails this is not the email address actually in use.
395-
* Use `configured_addr` to find out the email address actually in use.
396-
* - `configured_addr` = Email address actually in use.
393+
* - `configured_addr` = Email address in use.
397394
* Unless for testing, do not set this value using dc_set_config().
398395
* Instead, set `addr` and call dc_configure().
399-
* - `mail_server` = IMAP-server, guessed if left out
400-
* - `mail_user` = IMAP-username, guessed if left out
401-
* - `mail_pw` = IMAP-password (always needed)
402-
* - `mail_port` = IMAP-port, guessed if left out
403-
* - `mail_security`= IMAP-socket, one of @ref DC_SOCKET, defaults to #DC_SOCKET_AUTO
404-
* - `send_server` = SMTP-server, guessed if left out
405-
* - `send_user` = SMTP-user, guessed if left out
406-
* - `send_pw` = SMTP-password, guessed if left out
407-
* - `send_port` = SMTP-port, guessed if left out
408-
* - `send_security`= SMTP-socket, one of @ref DC_SOCKET, defaults to #DC_SOCKET_AUTO
409-
* - `server_flags` = IMAP-/SMTP-flags as a combination of @ref DC_LP flags, guessed if left out
410-
* - `proxy_enabled` = Proxy enabled. Disabled by default.
411-
* - `proxy_url` = Proxy URL. May contain multiple URLs separated by newline, but only the first one is used.
412-
* - `imap_certificate_checks` = how to check IMAP and SMTP certificates, one of the @ref DC_CERTCK flags, defaults to #DC_CERTCK_AUTO (0)
413396
* - `displayname` = Own name to use when sending messages. MUAs are allowed to spread this way e.g. using CC, defaults to empty
414397
* - `selfstatus` = Own status to display, e.g. in e-mail footers, defaults to empty
415398
* - `selfavatar` = File containing avatar. Will immediately be copied to the
@@ -512,6 +495,27 @@ char* dc_get_blobdir (const dc_context_t* context);
512495
* 1 = Contacts (default, does not include contact requests),
513496
* 2 = Nobody (calls never result in a notification).
514497
*
498+
* Also, there are configs that are only needed
499+
* if you want to use the deprecated dc_configure() API, such as:
500+
*
501+
* - `addr` = Email address to use for configuration.
502+
* If dc_configure() fails this is not the email address actually in use.
503+
* Use `configured_addr` to find out the email address actually in use.
504+
* - `mail_server` = IMAP-server, guessed if left out
505+
* - `mail_user` = IMAP-username, guessed if left out
506+
* - `mail_pw` = IMAP-password (always needed)
507+
* - `mail_port` = IMAP-port, guessed if left out
508+
* - `mail_security`= IMAP-socket, one of @ref DC_SOCKET, defaults to #DC_SOCKET_AUTO
509+
* - `send_server` = SMTP-server, guessed if left out
510+
* - `send_user` = SMTP-user, guessed if left out
511+
* - `send_pw` = SMTP-password, guessed if left out
512+
* - `send_port` = SMTP-port, guessed if left out
513+
* - `send_security`= SMTP-socket, one of @ref DC_SOCKET, defaults to #DC_SOCKET_AUTO
514+
* - `server_flags` = IMAP-/SMTP-flags as a combination of @ref DC_LP flags, guessed if left out
515+
* - `proxy_enabled` = Proxy enabled. Disabled by default.
516+
* - `proxy_url` = Proxy URL. May contain multiple URLs separated by newline, but only the first one is used.
517+
* - `imap_certificate_checks` = how to check IMAP and SMTP certificates, one of the @ref DC_CERTCK flags, defaults to #DC_CERTCK_AUTO (0)
518+
515519
* If you want to retrieve a value, use dc_get_config().
516520
*
517521
* @memberof dc_context_t
@@ -698,6 +702,12 @@ int dc_get_push_state (dc_context_t* context);
698702

699703
/**
700704
* Configure a context.
705+
*
706+
* This way of configuring a context is deprecated,
707+
* and does not allow to configure multiple transports.
708+
* If you can, use the JSON-RPC API (../deltachat-jsonrpc/src/api.rs)
709+
* `add_or_update_transport()`/`addOrUpdateTransport()` instead.
710+
*
701711
* During configuration IO must not be started,
702712
* if needed stop IO using dc_accounts_stop_io() or dc_stop_io() first.
703713
* If the context is already configured,

src/config.rs

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,85 @@ use crate::{constants, stats};
4242
)]
4343
#[strum(serialize_all = "snake_case")]
4444
pub enum Config {
45+
/// Deprecated(2026-04).
46+
/// Use ConfiguredAddr, [`crate::login_param::EnteredLoginParam`],
47+
/// or add_transport{from_qr}()/list_transports() instead.
48+
///
4549
/// Email address, used in the `From:` field.
4650
Addr,
4751

52+
/// Deprecated(2026-04).
53+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
54+
///
4855
/// IMAP server hostname.
4956
MailServer,
5057

58+
/// Deprecated(2026-04).
59+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
60+
///
5161
/// IMAP server username.
5262
MailUser,
5363

64+
/// Deprecated(2026-04).
65+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
66+
///
5467
/// IMAP server password.
5568
MailPw,
5669

70+
/// Deprecated(2026-04).
71+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
72+
///
5773
/// IMAP server port.
5874
MailPort,
5975

76+
/// Deprecated(2026-04).
77+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
78+
///
6079
/// IMAP server security (e.g. TLS, STARTTLS).
6180
MailSecurity,
6281

82+
/// Deprecated(2026-04).
83+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
84+
///
6385
/// How to check TLS certificates.
6486
///
6587
/// "IMAP" in the name is for compatibility,
6688
/// this actually applies to both IMAP and SMTP connections.
6789
ImapCertificateChecks,
6890

91+
/// Deprecated(2026-04).
92+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
93+
///
6994
/// SMTP server hostname.
7095
SendServer,
7196

97+
/// Deprecated(2026-04).
98+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
99+
///
72100
/// SMTP server username.
73101
SendUser,
74102

103+
/// Deprecated(2026-04).
104+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
105+
///
75106
/// SMTP server password.
76107
SendPw,
77108

109+
/// Deprecated(2026-04).
110+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
111+
///
78112
/// SMTP server port.
79113
SendPort,
80114

115+
/// Deprecated(2026-04).
116+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
117+
///
81118
/// SMTP server security (e.g. TLS, STARTTLS).
82119
SendSecurity,
83120

121+
/// Deprecated(2026-04).
122+
/// Use EnteredLoginParam and add_transport{from_qr}()/list_transports() instead.
123+
///
84124
/// Whether to use OAuth 2.
85125
///
86126
/// Historically contained other bitflags, which are now deprecated.
@@ -180,32 +220,47 @@ pub enum Config {
180220
/// The primary email address.
181221
ConfiguredAddr,
182222

223+
/// Deprecated(2026-04).
224+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
225+
///
183226
/// List of configured IMAP servers as a JSON array.
184227
ConfiguredImapServers,
185228

229+
/// Deprecated(2026-04).
230+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
231+
///
186232
/// Configured IMAP server hostname.
187233
///
188234
/// This is replaced by `configured_imap_servers` for new configurations.
189235
ConfiguredMailServer,
190236

191-
/// Configured IMAP server port.
237+
/// Deprecated(2026-04).
238+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
192239
///
193-
/// This is replaced by `configured_imap_servers` for new configurations.
240+
/// Configured IMAP server port.
194241
ConfiguredMailPort,
195242

196-
/// Configured IMAP server security (e.g. TLS, STARTTLS).
243+
/// Deprecated(2026-04).
244+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
197245
///
198-
/// This is replaced by `configured_imap_servers` for new configurations.
246+
/// Configured IMAP server security (e.g. TLS, STARTTLS).
199247
ConfiguredMailSecurity,
200248

201-
/// Configured IMAP server username.
249+
/// Deprecated(2026-04).
250+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
202251
///
203-
/// This is set if user has configured username manually.
252+
/// Configured IMAP server username.
204253
ConfiguredMailUser,
205254

255+
/// Deprecated(2026-04).
256+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
257+
///
206258
/// Configured IMAP server password.
207259
ConfiguredMailPw,
208260

261+
/// Deprecated(2026-04).
262+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
263+
///
209264
/// Configured TLS certificate checks.
210265
/// This option is saved on successful configuration
211266
/// and should not be modified manually.
@@ -214,32 +269,53 @@ pub enum Config {
214269
/// but has "IMAP" in the name for backwards compatibility.
215270
ConfiguredImapCertificateChecks,
216271

272+
/// Deprecated(2026-04).
273+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
274+
///
217275
/// List of configured SMTP servers as a JSON array.
218276
ConfiguredSmtpServers,
219277

278+
/// Deprecated(2026-04).
279+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
280+
///
220281
/// Configured SMTP server hostname.
221282
///
222283
/// This is replaced by `configured_smtp_servers` for new configurations.
223284
ConfiguredSendServer,
224285

286+
/// Deprecated(2026-04).
287+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
288+
///
225289
/// Configured SMTP server port.
226290
///
227291
/// This is replaced by `configured_smtp_servers` for new configurations.
228292
ConfiguredSendPort,
229293

294+
/// Deprecated(2026-04).
295+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
296+
///
230297
/// Configured SMTP server security (e.g. TLS, STARTTLS).
231298
///
232299
/// This is replaced by `configured_smtp_servers` for new configurations.
233300
ConfiguredSendSecurity,
234301

302+
/// Deprecated(2026-04).
303+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
304+
///
235305
/// Configured SMTP server username.
236306
///
237307
/// This is set if user has configured username manually.
238308
ConfiguredSendUser,
239309

310+
/// Deprecated(2026-04).
311+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
312+
///
240313
/// Configured SMTP server password.
241314
ConfiguredSendPw,
242315

316+
/// Deprecated(2026-04).
317+
/// Use ConfiguredLoginParam and add_transport{from_qr}()/list_transports() instead.
318+
///
243319
/// Whether OAuth 2 is used with configured provider.
244320
ConfiguredServerFlags,
245321

@@ -252,6 +328,9 @@ pub enum Config {
252328
/// ID of the configured provider from the provider database.
253329
ConfiguredProvider,
254330

331+
/// Deprecated(2026-04).
332+
/// Use [`Context::is_configured()`] instead.
333+
///
255334
/// True if account is configured.
256335
Configured,
257336

0 commit comments

Comments
 (0)