pub struct AccountConfig {Show 13 fields
pub name: String,
pub email: String,
pub display_name: Option<String>,
pub signature: Option<String>,
pub signature_delim: Option<String>,
pub downloads_dir: Option<PathBuf>,
pub folder: Option<FolderConfig>,
pub envelope: Option<EnvelopeConfig>,
pub flag: Option<FlagConfig>,
pub message: Option<MessageConfig>,
pub template: Option<TemplateConfig>,
pub sync: Option<SyncConfig>,
pub pgp: Option<PgpConfig>,
}Expand description
The user’s account configuration.
It represents everything that the user can customize for a given account. It is the main configuration used by all other modules. Usually, it serves as a reference for building config file structure.
Fields§
§name: StringThe name of the user account.
The account name is used as an unique identifier for a given configuration.
email: StringThe email address of the user account.
display_name: Option<String>The display name of the user.
It usually corresponds to the full name of the user.
signature: Option<String>The email signature of the user.
It can be either a path to a file (usually ~/.signature) or
a raw string.
signature_delim: Option<String>The email signature delimiter of the user signature.
Defaults to -- \n.
downloads_dir: Option<PathBuf>The downloads directory.
It is mostly used for downloading messages
attachments. Defaults to the system temporary directory
(usually /tmp).
folder: Option<FolderConfig>The folder configuration.
envelope: Option<EnvelopeConfig>The envelope configuration.
flag: Option<FlagConfig>The flag configuration.
message: Option<MessageConfig>The message configuration.
template: Option<TemplateConfig>The message configuration.
sync: Option<SyncConfig>The account synchronization configuration.
pgp: Option<PgpConfig>The PGP configuration.
Implementations§
Source§impl AccountConfig
impl AccountConfig
Sourcepub fn find_full_signature(&self) -> Option<String>
pub fn find_full_signature(&self) -> Option<String>
Get the signature, including the delimiter.
Uses the default delimiter -- \n in case no delimiter has
been defined. Return None if no signature has been defined.
Sourcepub fn get_downloads_dir(&self) -> PathBuf
pub fn get_downloads_dir(&self) -> PathBuf
Get then expand the downloads directory path.
Falls back to dirs::download_dir.
Sourcepub fn get_download_file_path(
&self,
downloads_dir: Option<&Path>,
path: impl AsRef<Path>,
) -> Result<PathBuf>
pub fn get_download_file_path( &self, downloads_dir: Option<&Path>, path: impl AsRef<Path>, ) -> Result<PathBuf>
Build the downloadable version of the given path.
The aim of this helper is to build a safe download path for a given path.
First, only the file name of the give path is taken in order to prevent any interaction outside of the downloads directory.
Then, a suffix may be added to the final path if it already exists on the filesystem in order to prevent any overriding or data loss.
Sourcepub fn is_sync_enabled(&self) -> bool
pub fn is_sync_enabled(&self) -> bool
Return true if the synchronization is enabled.
Sourcepub fn does_sync_dir_exist(&self) -> bool
pub fn does_sync_dir_exist(&self) -> bool
Return true if the synchronization directory already exists.
Sourcepub async fn exec_received_envelope_hook(&self, envelope: &Envelope)
pub async fn exec_received_envelope_hook(&self, envelope: &Envelope)
Execute the envelope received hook.
Sourcepub async fn exec_any_envelope_hook(&self, envelope: &Envelope)
pub async fn exec_any_envelope_hook(&self, envelope: &Envelope)
Execute the envelope any hook.
Sourcepub async fn exec_envelope_hook(&self, hook: &WatchHook, envelope: &Envelope)
pub async fn exec_envelope_hook(&self, hook: &WatchHook, envelope: &Envelope)
Execute the given envelope hook.
Sourcepub fn find_folder_alias(&self, from_name: &str) -> Option<String>
pub fn find_folder_alias(&self, from_name: &str) -> Option<String>
Find the alias of the given folder name.
The alias is also shell expanded.
Sourcepub fn get_folder_alias(&self, folder: &str) -> String
pub fn get_folder_alias(&self, folder: &str) -> String
Find the alias of the given folder, otherwise return the given folder itself.
Sourcepub fn get_inbox_folder_alias(&self) -> String
pub fn get_inbox_folder_alias(&self) -> String
Get the inbox folder alias.
Sourcepub fn get_sent_folder_alias(&self) -> String
pub fn get_sent_folder_alias(&self) -> String
Get the sent folder alias.
Sourcepub fn get_drafts_folder_alias(&self) -> String
pub fn get_drafts_folder_alias(&self) -> String
Get the drafts folder alias.
Sourcepub fn get_trash_folder_alias(&self) -> String
pub fn get_trash_folder_alias(&self) -> String
Get the trash folder alias.
Sourcepub fn is_trash_folder(&self, folder: &str) -> bool
pub fn is_trash_folder(&self, folder: &str) -> bool
Return true if the given folder matches the Trash folder.
Sourcepub fn is_delete_message_style_flag(&self) -> bool
pub fn is_delete_message_style_flag(&self) -> bool
Return true if the delete message style matches the
flag-based message deletion style.
Sourcepub fn find_folder_kind_from_alias(&self, alias: &str) -> Option<FolderKind>
pub fn find_folder_kind_from_alias(&self, alias: &str) -> Option<FolderKind>
Find the folder kind associated to the given folder alias.
This function is the reverse of [get_folder_alias], as it
tries to find a key (folder kind) matching the given value
(folder alias).
Sourcepub fn get_envelope_list_page_size(&self) -> usize
pub fn get_envelope_list_page_size(&self) -> usize
Get the envelope listing page size if defined, otherwise return the default one.
Sourcepub fn get_envelope_thread_page_size(&self) -> usize
pub fn get_envelope_thread_page_size(&self) -> usize
Get the envelope threading page size if defined, otherwise return the default one.
Sourcepub fn get_message_read_format(&self) -> EmailTextPlainFormat
pub fn get_message_read_format(&self) -> EmailTextPlainFormat
Get the message reading format if defined, otherwise return the default one.
Sourcepub fn get_message_read_headers(&self) -> Vec<String>
pub fn get_message_read_headers(&self) -> Vec<String>
Get the message reading headers if defined, otherwise return the default ones.
Sourcepub fn get_message_write_headers(&self) -> Vec<String>
pub fn get_message_write_headers(&self) -> Vec<String>
Get the message writing headers if defined, otherwise return the default ones.
Sourcepub fn find_message_pre_send_hook(&self) -> Option<&Command>
pub fn find_message_pre_send_hook(&self) -> Option<&Command>
Find the message pre-send hook.
Sourcepub fn should_save_copy_sent_message(&self) -> bool
pub fn should_save_copy_sent_message(&self) -> bool
Return true if a copy of sent messages should be saved in
the sent folder.
Sourcepub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder
pub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder
Generate a template interpreter with prefilled options from the current user account configuration.
Sourcepub fn get_envelope_list_datetime_fmt(&self) -> String
pub fn get_envelope_list_datetime_fmt(&self) -> String
Get the envelope listing datetime format, otherwise return the default one.
Sourcepub fn has_envelope_list_datetime_local_tz(&self) -> bool
pub fn has_envelope_list_datetime_local_tz(&self) -> bool
Return true if the envelope listing datetime local timezone
option is enabled.
Sourcepub fn get_new_template_signature_style(&self) -> NewTemplateSignatureStyle
pub fn get_new_template_signature_style(&self) -> NewTemplateSignatureStyle
Get the new template signature placement.
pub fn get_reply_template_signature_style(&self) -> ReplyTemplateSignatureStyle
pub fn get_reply_template_posting_style(&self) -> ReplyTemplatePostingStyle
pub fn get_reply_template_quote_headline( &self, msg: &Message<'_>, ) -> Option<String>
pub fn get_forward_template_signature_style( &self, ) -> ForwardTemplateSignatureStyle
pub fn get_forward_template_posting_style(&self) -> ForwardTemplatePostingStyle
pub fn get_forward_template_quote_headline(&self) -> String
Trait Implementations§
Source§impl Clone for AccountConfig
impl Clone for AccountConfig
Source§fn clone(&self) -> AccountConfig
fn clone(&self) -> AccountConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountConfig
impl Debug for AccountConfig
Source§impl Default for AccountConfig
impl Default for AccountConfig
Source§fn default() -> AccountConfig
fn default() -> AccountConfig
Source§impl<'de> Deserialize<'de> for AccountConfig
impl<'de> Deserialize<'de> for AccountConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<&'a AccountConfig> for Address<'a>
impl<'a> From<&'a AccountConfig> for Address<'a>
Source§fn from(config: &'a AccountConfig) -> Self
fn from(config: &'a AccountConfig) -> Self
Source§impl PartialEq for AccountConfig
impl PartialEq for AccountConfig
Source§impl Serialize for AccountConfig
impl Serialize for AccountConfig
impl Eq for AccountConfig
impl StructuralPartialEq for AccountConfig
Auto Trait Implementations§
impl Freeze for AccountConfig
impl !RefUnwindSafe for AccountConfig
impl Send for AccountConfig
impl Sync for AccountConfig
impl Unpin for AccountConfig
impl UnsafeUnpin for AccountConfig
impl !UnwindSafe for AccountConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more