From 15f23b4b0693094d81fa9edcd259e50185910760 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 25 Jul 2026 12:41:55 +0200 Subject: [PATCH 1/3] fix: Re-add oauth2 to serialized structs Followup to https://github.com/chatmail/core/pull/8431: Re-dd `oauth2` to the two structs that serialized and sent over the wire. This solves an incompatibility problem where transports could not be synced to older versions of DC, and profiles could not be transferred, because the deserializer expected the field to be present. I now added `#[serde(default)]`, so that with this PR, Delta Chat will be compatible with both v2.56 and with older versions. Not tested yet. --- deltachat-jsonrpc/src/api/types/login_param.rs | 1 + src/login_param.rs | 6 ++++++ src/qr.rs | 2 ++ src/qr/dclogin_scheme.rs | 1 + src/transport.rs | 4 ++++ 5 files changed, 14 insertions(+) diff --git a/deltachat-jsonrpc/src/api/types/login_param.rs b/deltachat-jsonrpc/src/api/types/login_param.rs index 72b8fd66b1..36d6ed9ffc 100644 --- a/deltachat-jsonrpc/src/api/types/login_param.rs +++ b/deltachat-jsonrpc/src/api/types/login_param.rs @@ -122,6 +122,7 @@ impl TryFrom for dc::EnteredLoginParam { password: param.smtp_password.unwrap_or_default(), }, certificate_checks: param.certificate_checks.unwrap_or_default().into(), + oauth2: false, }) } } diff --git a/src/login_param.rs b/src/login_param.rs index 723621b432..32e28ce594 100644 --- a/src/login_param.rs +++ b/src/login_param.rs @@ -140,6 +140,10 @@ pub struct EnteredLoginParam { /// TLS options: whether to allow invalid certificates and/or /// invalid hostnames pub certificate_checks: EnteredCertificateChecks, + + /// Deprecated, always false + #[serde(default)] + pub oauth2: bool, } impl EnteredLoginParam { @@ -235,6 +239,7 @@ impl EnteredLoginParam { password: send_pw, }, certificate_checks, + oauth2: false, }) } @@ -396,6 +401,7 @@ mod tests { password: "".to_string(), }, certificate_checks: Default::default(), + oauth2: false, }; param.save_legacy(&t).await?; assert_eq!( diff --git a/src/qr.rs b/src/qr.rs index 4059382753..9a07249555 100644 --- a/src/qr.rs +++ b/src/qr.rs @@ -841,6 +841,7 @@ pub(crate) async fn login_param_from_account_qr( }, smtp: Default::default(), certificate_checks: EnteredCertificateChecks::Strict, + oauth2: false, }; return Ok(param); } @@ -860,6 +861,7 @@ pub(crate) async fn login_param_from_account_qr( }, smtp: Default::default(), certificate_checks: EnteredCertificateChecks::Strict, + oauth2: false, }; Ok(param) diff --git a/src/qr/dclogin_scheme.rs b/src/qr/dclogin_scheme.rs index 97e06ceb87..5ef2c47ab2 100644 --- a/src/qr/dclogin_scheme.rs +++ b/src/qr/dclogin_scheme.rs @@ -196,6 +196,7 @@ pub(crate) fn login_param_from_login_qr( password: smtp_password.unwrap_or_default(), }, certificate_checks: certificate_checks.unwrap_or_default(), + oauth2: false, }; Ok(param) } diff --git a/src/transport.rs b/src/transport.rs index 1d4f54b35e..a4cbc919e7 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -212,6 +212,9 @@ pub(crate) struct ConfiguredLoginParamJson { pub smtp_password: String, pub certificate_checks: ConfiguredCertificateChecks, + + #[serde(default)] + pub oauth2: bool, } impl fmt::Display for ConfiguredLoginParam { @@ -488,6 +491,7 @@ impl From for ConfiguredLoginParamJson { smtp_password: configured_login_param.smtp_password, certificate_checks: configured_login_param.certificate_checks, + oauth2: false, } } } From da9e8e7dabcca77c1a77e2bdb145b77fb312fd22 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 25 Jul 2026 13:25:03 +0200 Subject: [PATCH 2/3] Fix test --- src/transport/transport_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transport/transport_tests.rs b/src/transport/transport_tests.rs index f31661ca06..ec44a7bfd0 100644 --- a/src/transport/transport_tests.rs +++ b/src/transport/transport_tests.rs @@ -52,7 +52,7 @@ async fn test_save_load_login_param() -> Result<()> { .clone() .save_to_transports_table(&t, &EnteredLoginParam::default(), time()) .await?; - let expected_param = r#"{"addr":"alice@example.org","imap":[{"connection":{"host":"imap.example.com","port":123,"security":"Starttls"},"user":"alice"}],"imap_folder":"Folder","imap_user":"","imap_password":"foo","smtp":[{"connection":{"host":"smtp.example.com","port":456,"security":"Tls"},"user":"alice@example.org"}],"smtp_user":"","smtp_password":"bar","certificate_checks":"Strict"}"#; + let expected_param = r#"{"addr":"alice@example.org","imap":[{"connection":{"host":"imap.example.com","port":123,"security":"Starttls"},"user":"alice"}],"imap_folder":"Folder","imap_user":"","imap_password":"foo","smtp":[{"connection":{"host":"smtp.example.com","port":456,"security":"Tls"},"user":"alice@example.org"}],"smtp_user":"","smtp_password":"bar","certificate_checks":"Strict","oauth2":false}"#; assert_eq!( t.sql .query_get_value::("SELECT configured_param FROM transports", ()) From 431095328f1197566ef4e655d67a94baa7c4553e Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 25 Jul 2026 13:34:36 +0200 Subject: [PATCH 3/3] Better deprecated comment --- src/login_param.rs | 2 +- src/transport.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/login_param.rs b/src/login_param.rs index 32e28ce594..1f1c0eb284 100644 --- a/src/login_param.rs +++ b/src/login_param.rs @@ -141,7 +141,7 @@ pub struct EnteredLoginParam { /// invalid hostnames pub certificate_checks: EnteredCertificateChecks, - /// Deprecated, always false + /// Deprecated 2026-07, always false #[serde(default)] pub oauth2: bool, } diff --git a/src/transport.rs b/src/transport.rs index a4cbc919e7..c2ef62260f 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -213,6 +213,7 @@ pub(crate) struct ConfiguredLoginParamJson { pub certificate_checks: ConfiguredCertificateChecks, + /// Deprecated 2026-07, always false #[serde(default)] pub oauth2: bool, }