mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Rename {mail,send}_certificate_checks into {imap,smtp}_certificate_checks
This commit is contained in:
@@ -19,12 +19,12 @@ pub enum Config {
|
|||||||
MailUser,
|
MailUser,
|
||||||
MailPw,
|
MailPw,
|
||||||
MailPort,
|
MailPort,
|
||||||
MailCertificateChecks,
|
ImapCertificateChecks,
|
||||||
SendServer,
|
SendServer,
|
||||||
SendUser,
|
SendUser,
|
||||||
SendPw,
|
SendPw,
|
||||||
SendPort,
|
SendPort,
|
||||||
SendCertificateChecks,
|
SmtpCertificateChecks,
|
||||||
ServerFlags,
|
ServerFlags,
|
||||||
#[strum(props(default = "INBOX"))]
|
#[strum(props(default = "INBOX"))]
|
||||||
ImapFolder,
|
ImapFolder,
|
||||||
@@ -54,12 +54,12 @@ pub enum Config {
|
|||||||
ConfiguredMailPw,
|
ConfiguredMailPw,
|
||||||
ConfiguredMailPort,
|
ConfiguredMailPort,
|
||||||
ConfiguredMailSecurity,
|
ConfiguredMailSecurity,
|
||||||
ConfiguredMailCertificateChecks,
|
ConfiguredImapCertificateChecks,
|
||||||
ConfiguredSendServer,
|
ConfiguredSendServer,
|
||||||
ConfiguredSendUser,
|
ConfiguredSendUser,
|
||||||
ConfiguredSendPw,
|
ConfiguredSendPw,
|
||||||
ConfiguredSendPort,
|
ConfiguredSendPort,
|
||||||
ConfiguredSendCertificateChecks,
|
ConfiguredSmtpCertificateChecks,
|
||||||
ConfiguredServerFlags,
|
ConfiguredServerFlags,
|
||||||
ConfiguredSendSecurity,
|
ConfiguredSendSecurity,
|
||||||
ConfiguredE2EEEnabled,
|
ConfiguredE2EEEnabled,
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ impl Imap {
|
|||||||
config.imap_port = imap_port;
|
config.imap_port = imap_port;
|
||||||
config.imap_user = imap_user.to_string();
|
config.imap_user = imap_user.to_string();
|
||||||
config.imap_pw = imap_pw.to_string();
|
config.imap_pw = imap_pw.to_string();
|
||||||
config.certificate_checks = lp.mail_certificate_checks;
|
config.certificate_checks = lp.imap_certificate_checks;
|
||||||
config.server_flags = server_flags;
|
config.server_flags = server_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ pub struct LoginParam {
|
|||||||
pub mail_pw: String,
|
pub mail_pw: String,
|
||||||
pub mail_port: i32,
|
pub mail_port: i32,
|
||||||
/// IMAP TLS options: whether to allow invalid certificates and/or invalid hostnames
|
/// IMAP TLS options: whether to allow invalid certificates and/or invalid hostnames
|
||||||
pub mail_certificate_checks: CertificateChecks,
|
pub imap_certificate_checks: CertificateChecks,
|
||||||
pub send_server: String,
|
pub send_server: String,
|
||||||
pub send_user: String,
|
pub send_user: String,
|
||||||
pub send_pw: String,
|
pub send_pw: String,
|
||||||
pub send_port: i32,
|
pub send_port: i32,
|
||||||
/// SMTP TLS options: whether to allow invalid certificates and/or invalid hostnames
|
/// SMTP TLS options: whether to allow invalid certificates and/or invalid hostnames
|
||||||
pub send_certificate_checks: CertificateChecks,
|
pub smtp_certificate_checks: CertificateChecks,
|
||||||
pub server_flags: i32,
|
pub server_flags: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +67,8 @@ impl LoginParam {
|
|||||||
let key = format!("{}mail_pw", prefix);
|
let key = format!("{}mail_pw", prefix);
|
||||||
let mail_pw = sql.get_config(context, key).unwrap_or_default();
|
let mail_pw = sql.get_config(context, key).unwrap_or_default();
|
||||||
|
|
||||||
let key = format!("{}mail_certificate_checks", prefix);
|
let key = format!("{}imap_certificate_checks", prefix);
|
||||||
let mail_certificate_checks =
|
let imap_certificate_checks =
|
||||||
if let Some(certificate_checks) = sql.get_config_int(context, key) {
|
if let Some(certificate_checks) = sql.get_config_int(context, key) {
|
||||||
num_traits::FromPrimitive::from_i32(certificate_checks).unwrap_or_default()
|
num_traits::FromPrimitive::from_i32(certificate_checks).unwrap_or_default()
|
||||||
} else {
|
} else {
|
||||||
@@ -87,8 +87,8 @@ impl LoginParam {
|
|||||||
let key = format!("{}send_pw", prefix);
|
let key = format!("{}send_pw", prefix);
|
||||||
let send_pw = sql.get_config(context, key).unwrap_or_default();
|
let send_pw = sql.get_config(context, key).unwrap_or_default();
|
||||||
|
|
||||||
let key = format!("{}send_certificate_checks", prefix);
|
let key = format!("{}smtp_certificate_checks", prefix);
|
||||||
let send_certificate_checks =
|
let smtp_certificate_checks =
|
||||||
if let Some(certificate_checks) = sql.get_config_int(context, key) {
|
if let Some(certificate_checks) = sql.get_config_int(context, key) {
|
||||||
num_traits::FromPrimitive::from_i32(certificate_checks).unwrap_or_default()
|
num_traits::FromPrimitive::from_i32(certificate_checks).unwrap_or_default()
|
||||||
} else {
|
} else {
|
||||||
@@ -104,12 +104,12 @@ impl LoginParam {
|
|||||||
mail_user,
|
mail_user,
|
||||||
mail_pw,
|
mail_pw,
|
||||||
mail_port,
|
mail_port,
|
||||||
mail_certificate_checks,
|
imap_certificate_checks,
|
||||||
send_server,
|
send_server,
|
||||||
send_user,
|
send_user,
|
||||||
send_pw,
|
send_pw,
|
||||||
send_port,
|
send_port,
|
||||||
send_certificate_checks,
|
smtp_certificate_checks,
|
||||||
server_flags,
|
server_flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,8 +142,8 @@ impl LoginParam {
|
|||||||
let key = format!("{}mail_pw", prefix);
|
let key = format!("{}mail_pw", prefix);
|
||||||
sql.set_config(context, key, Some(&self.mail_pw))?;
|
sql.set_config(context, key, Some(&self.mail_pw))?;
|
||||||
|
|
||||||
let key = format!("{}mail_certificate_checks", prefix);
|
let key = format!("{}imap_certificate_checks", prefix);
|
||||||
sql.set_config_int(context, key, self.mail_certificate_checks as i32)?;
|
sql.set_config_int(context, key, self.imap_certificate_checks as i32)?;
|
||||||
|
|
||||||
let key = format!("{}send_server", prefix);
|
let key = format!("{}send_server", prefix);
|
||||||
sql.set_config(context, key, Some(&self.send_server))?;
|
sql.set_config(context, key, Some(&self.send_server))?;
|
||||||
@@ -157,8 +157,8 @@ impl LoginParam {
|
|||||||
let key = format!("{}send_pw", prefix);
|
let key = format!("{}send_pw", prefix);
|
||||||
sql.set_config(context, key, Some(&self.send_pw))?;
|
sql.set_config(context, key, Some(&self.send_pw))?;
|
||||||
|
|
||||||
let key = format!("{}send_certificate_checks", prefix);
|
let key = format!("{}smtp_certificate_checks", prefix);
|
||||||
sql.set_config_int(context, key, self.send_certificate_checks as i32)?;
|
sql.set_config_int(context, key, self.smtp_certificate_checks as i32)?;
|
||||||
|
|
||||||
let key = format!("{}server_flags", prefix);
|
let key = format!("{}server_flags", prefix);
|
||||||
sql.set_config_int(context, key, self.server_flags)?;
|
sql.set_config_int(context, key, self.server_flags)?;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ impl Smtp {
|
|||||||
let port = lp.send_port as u16;
|
let port = lp.send_port as u16;
|
||||||
|
|
||||||
let mut tls_builder = native_tls::TlsConnector::builder();
|
let mut tls_builder = native_tls::TlsConnector::builder();
|
||||||
let tls = match lp.send_certificate_checks {
|
let tls = match lp.smtp_certificate_checks {
|
||||||
CertificateChecks::Automatic => {
|
CertificateChecks::Automatic => {
|
||||||
// Same as AcceptInvalidCertificates for now.
|
// Same as AcceptInvalidCertificates for now.
|
||||||
// TODO: use provider database when it becomes available
|
// TODO: use provider database when it becomes available
|
||||||
|
|||||||
Reference in New Issue
Block a user