melib/smtp: add serde field default values
parent
8ec0da4fbd
commit
d8f2a08e7b
|
@ -107,11 +107,15 @@ impl MailboxConf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate::conf) fn false_val() -> bool {
|
pub fn true_val() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn false_val() -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate::conf) fn none<T>() -> Option<T> {
|
pub fn none<T>() -> Option<T> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,22 +173,33 @@ pub struct SmtpServerConf {
|
||||||
/// Configured SMTP extensions to use
|
/// Configured SMTP extensions to use
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct SmtpExtensionSupport {
|
pub struct SmtpExtensionSupport {
|
||||||
|
#[serde(default = "crate::conf::true_val")]
|
||||||
pipelining: bool,
|
pipelining: bool,
|
||||||
|
#[serde(default = "crate::conf::true_val")]
|
||||||
chunking: bool,
|
chunking: bool,
|
||||||
//Essentially, the PRDR extension to SMTP allows (but does not require) an SMTP server to
|
//Essentially, the PRDR extension to SMTP allows (but does not require) an SMTP server to
|
||||||
//issue multiple responses after a message has been transferred, by mutual consent of the
|
//issue multiple responses after a message has been transferred, by mutual consent of the
|
||||||
//client and server. SMTP clients that support the PRDR extension then use the expanded
|
//client and server. SMTP clients that support the PRDR extension then use the expanded
|
||||||
//responses as supplemental data to the responses that were received during the earlier
|
//responses as supplemental data to the responses that were received during the earlier
|
||||||
//envelope exchange.
|
//envelope exchange.
|
||||||
|
#[serde(default = "crate::conf::true_val")]
|
||||||
prdr: bool,
|
prdr: bool,
|
||||||
|
#[serde(default = "crate::conf::false_val")]
|
||||||
binarymime: bool,
|
binarymime: bool,
|
||||||
//Resources:
|
//Resources:
|
||||||
//- http://www.postfix.org/SMTPUTF8_README.html
|
//- http://www.postfix.org/SMTPUTF8_README.html
|
||||||
|
#[serde(default = "crate::conf::true_val")]
|
||||||
smtputf8: bool,
|
smtputf8: bool,
|
||||||
|
#[serde(default = "crate::conf::true_val")]
|
||||||
auth: bool,
|
auth: bool,
|
||||||
|
#[serde(default = "default_dsn")]
|
||||||
dsn_notify: Option<Cow<'static, str>>,
|
dsn_notify: Option<Cow<'static, str>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_dsn() -> Option<Cow<'static, str>> {
|
||||||
|
Some("FAILURE".into())
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for SmtpExtensionSupport {
|
impl Default for SmtpExtensionSupport {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
Loading…
Reference in New Issue