summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-mail/src/config.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-04-18 11:18:07 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-06-01 14:01:39 +0200
commit70f974ee7ab1d15a200d625878bd8b7db861bb98 (patch)
treeb6eca3d13c7f1f6223add6005a5c9c4f972ccf55 /bin/domain/imag-mail/src/config.rs
parent908972af726bc46089b4f5d92a53ff206c088657 (diff)
Add implementation for crafting new mail
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-mail/src/config.rs')
-rw-r--r--bin/domain/imag-mail/src/config.rs35
1 files changed, 32 insertions, 3 deletions
diff --git a/bin/domain/imag-mail/src/config.rs b/bin/domain/imag-mail/src/config.rs
index 0e43ac8e..a7a991d7 100644
--- a/bin/domain/imag-mail/src/config.rs
+++ b/bin/domain/imag-mail/src/config.rs
@@ -38,12 +38,25 @@ pub struct MailConfig {
import_tag: Option<String>,
#[serde(rename = "import_notmuch_tags")]
- import_notmuch_tags: bool
+ import_notmuch_tags: bool,
+
+ #[serde(rename = "edit_headers")]
+ edit_headers: bool,
+
+ #[serde(rename = "default_template")]
+ default_template: String,
+
+ #[serde(rename = "header_template")]
+ header_template: String,
+
+ #[serde(rename = "from_address")]
+ from_address: String,
+
}
impl MailConfig {
- pub fn get_list_format(&self, scmd: &ArgMatches) -> Result<Handlebars> {
+ pub fn get_list_format_or_cli(&self, scmd: &ArgMatches) -> Result<Handlebars> {
let fmt = scmd
.value_of("format")
.map(String::from)
@@ -58,7 +71,8 @@ impl MailConfig {
Ok(hb)
}
- pub fn get_notmuch_database_path(&self, rt: &Runtime) -> PathBuf {
+ /// Get the notmuch database path either from CLI or from config
+ pub fn get_notmuch_database_path_or_cli(&self, rt: &Runtime) -> PathBuf {
if let Some(pb) = rt.cli()
.value_of("database_path")
.map(String::from)
@@ -78,5 +92,20 @@ impl MailConfig {
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
+ }
}