diff options
Diffstat (limited to 'bin/domain/imag-mail/src/config.rs')
-rw-r--r-- | bin/domain/imag-mail/src/config.rs | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/bin/domain/imag-mail/src/config.rs b/bin/domain/imag-mail/src/config.rs index aaa47013..82e84585 100644 --- a/bin/domain/imag-mail/src/config.rs +++ b/bin/domain/imag-mail/src/config.rs @@ -25,31 +25,39 @@ use clap::ArgMatches; use libimagrt::runtime::Runtime; -#[derive(Debug, Serialize, Deserialize, Partial)] +#[derive(Debug, Serialize, Deserialize, Partial, AddGetter)] #[location = "mail"] pub struct MailConfig { #[serde(rename = "list_format")] + #[get] list_format: String, #[serde(rename = "notmuch_database")] + #[get] notmuch_database_path: PathBuf, #[serde(rename = "import_tag")] + #[get] import_tag: Option<String>, #[serde(rename = "import_notmuch_tags")] + #[get] import_notmuch_tags: bool, #[serde(rename = "edit_headers")] + #[get] edit_headers: bool, #[serde(rename = "default_template")] + #[get] default_template: String, #[serde(rename = "header_template")] + #[get] header_template: String, #[serde(rename = "from_address")] + #[get] from_address: String, /// The location where the mail is stored after it is written, but before it is sent. @@ -58,38 +66,47 @@ pub struct MailConfig { /// The mail-send-script should pick up each mail in here and process it. /// Not to be confused with "drafts" which are not intended for sending yet. #[serde(rename = "outgoing_maildir")] + #[get] outgoing_maildir: PathBuf, /// Path script to run before writing outgoing mail to outgoing_maildir (optional) #[serde(rename = "pre_outgoing")] + #[get] pre_outgoing: Option<PathBuf>, /// Path script to run after writing outgoing mail to outgoing_maildir (optional) #[serde(rename = "post_outgoing")] + #[get] post_outgoing: Option<PathBuf>, /// The location where to put drafted mails #[serde(rename = "draft_maildir")] + #[get] draft_maildir: PathBuf, /// Path script to run before writing draft mail to draft_maildir (optional) #[serde(rename = "pre_draft")] + #[get] pre_draft: Option<PathBuf>, /// Path script to run after writing draft mail to draft_maildir (optional) #[serde(rename = "post_draft")] + #[get] post_draft: Option<PathBuf>, /// The location where to put sent mails #[serde(rename = "sent_maildir")] + #[get] sent_maildir: PathBuf, /// Path script to run before writing mail to sent_maildir (optional) #[serde(rename = "pre_sent")] + #[get] pre_sent: Option<PathBuf>, /// Path script to run after writing mail to sent_maildir (optional) #[serde(rename = "post_sent")] + #[get] post_sent: Option<PathBuf>, @@ -103,34 +120,42 @@ pub struct MailConfig { /// /// STDERR of the script is logged by imag. #[serde(rename = "recv_script")] + #[get] recv_script: PathBuf, /// Whether to show output for each mail + #[get] recv_output: bool, /// Output format for each mail + #[get] recv_output_format: Option<String>, /// Whether to show summary output after receiving + #[get] recv_output_summary: bool, /// Summary output format after receiving + #[get] recv_output_summary_format: Option<String>, /// Script to be invoked before recving. (optional) /// /// STDERR of the script is logged by imag. #[serde(rename = "pre_recv_script")] + #[get] pre_recv_script: Option<PathBuf>, /// Script to be invoked after recving. (optional) /// /// STDERR of the script is logged by imag. #[serde(rename = "post_recv_script")] + #[get] post_recv_script: Option<PathBuf>, /// Whether to automatically import new emails #[serde(rename = "auto_import")] + #[get] auto_import: bool, // @@ -149,9 +174,12 @@ pub struct MailConfig { /// /// STDERR of the script is logged by imag. #[serde(rename = "send_script")] + #[get] send_script: PathBuf, /// Whether to show a progress bar when sending + #[serde(rename = "send_progress")] + #[get] send_progress: bool, /// If false, the invokation of the send scripts are chained. If one fails, the chain is @@ -160,6 +188,7 @@ pub struct MailConfig { /// If true, the script is invoked in parallel for all mails. If one fails, the others are still /// running. #[serde(rename = "send_parallel")] + #[get] send_parallel: bool, /// Script to be invoked before sending. (optional) @@ -170,6 +199,7 @@ pub struct MailConfig { /// /// STDERR of the script is logged by imag. #[serde(rename = "pre_send_script")] + #[get] pre_send_script: Option<PathBuf>, /// Script to be invoked after sending. (optional) @@ -178,6 +208,7 @@ pub struct MailConfig { /// /// STDERR of the script is logged by imag. #[serde(rename = "post_send_script")] + #[get] post_send_script: Option<PathBuf>, } @@ -210,29 +241,5 @@ impl MailConfig { self.notmuch_database_path.clone() } } - - pub fn get_import_tag(&self) -> Option<&String> { - self.import_tag.as_ref() - } - - pub fn get_import_notmuch_tags(&self) -> bool { - self.import_notmuch_tags - } - - pub fn get_edit_headers(&self) -> bool { - self.edit_headers - } - - pub fn get_default_template(&self) -> &String { - &self.default_template - } - - pub fn get_header_template(&self) -> &String { - &self.header_template - } - - pub fn get_from_address(&self) -> &String { - &self.from_address - } } |