Skip to main content

AccountConfig

Struct AccountConfig 

Source
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: String

The name of the user account.

The account name is used as an unique identifier for a given configuration.

§email: String

The 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

Source

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.

Source

pub fn get_downloads_dir(&self) -> PathBuf

Get then expand the downloads directory path.

Falls back to dirs::download_dir.

Source

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.

Source

pub fn is_sync_enabled(&self) -> bool

Return true if the synchronization is enabled.

Source

pub fn does_sync_dir_exist(&self) -> bool

Return true if the synchronization directory already exists.

Source

pub async fn exec_received_envelope_hook(&self, envelope: &Envelope)

Execute the envelope received hook.

Source

pub async fn exec_any_envelope_hook(&self, envelope: &Envelope)

Execute the envelope any hook.

Source

pub async fn exec_envelope_hook(&self, hook: &WatchHook, envelope: &Envelope)

Execute the given envelope hook.

Source

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.

Source

pub fn get_folder_alias(&self, folder: &str) -> String

Find the alias of the given folder, otherwise return the given folder itself.

Source

pub fn get_inbox_folder_alias(&self) -> String

Get the inbox folder alias.

Source

pub fn get_sent_folder_alias(&self) -> String

Get the sent folder alias.

Source

pub fn get_drafts_folder_alias(&self) -> String

Get the drafts folder alias.

Source

pub fn get_trash_folder_alias(&self) -> String

Get the trash folder alias.

Source

pub fn is_trash_folder(&self, folder: &str) -> bool

Return true if the given folder matches the Trash folder.

Source

pub fn is_delete_message_style_flag(&self) -> bool

Return true if the delete message style matches the flag-based message deletion style.

Source

pub fn get_folder_aliases(&self) -> Option<&HashMap<String, String>>

Get all folder aliases.

Source

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).

Source

pub fn get_envelope_list_page_size(&self) -> usize

Get the envelope listing page size if defined, otherwise return the default one.

Source

pub fn get_envelope_thread_page_size(&self) -> usize

Get the envelope threading page size if defined, otherwise return the default one.

Source

pub fn get_message_read_format(&self) -> EmailTextPlainFormat

Get the message reading format if defined, otherwise return the default one.

Source

pub fn get_message_read_headers(&self) -> Vec<String>

Get the message reading headers if defined, otherwise return the default ones.

Source

pub fn get_message_write_headers(&self) -> Vec<String>

Get the message writing headers if defined, otherwise return the default ones.

Source

pub fn find_message_pre_send_hook(&self) -> Option<&Command>

Find the message pre-send hook.

Source

pub fn should_save_copy_sent_message(&self) -> bool

Return true if a copy of sent messages should be saved in the sent folder.

Source

pub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder

Generate a template interpreter with prefilled options from the current user account configuration.

Source

pub fn get_envelope_list_datetime_fmt(&self) -> String

Get the envelope listing datetime format, otherwise return the default one.

Source

pub fn has_envelope_list_datetime_local_tz(&self) -> bool

Return true if the envelope listing datetime local timezone option is enabled.

Source

pub fn get_new_template_signature_style(&self) -> NewTemplateSignatureStyle

Get the new template signature placement.

Source

pub fn get_reply_template_signature_style(&self) -> ReplyTemplateSignatureStyle

Source

pub fn get_reply_template_posting_style(&self) -> ReplyTemplatePostingStyle

Source

pub fn get_reply_template_quote_headline( &self, msg: &Message<'_>, ) -> Option<String>

Source

pub fn get_forward_template_signature_style( &self, ) -> ForwardTemplateSignatureStyle

Source

pub fn get_forward_template_posting_style(&self) -> ForwardTemplatePostingStyle

Source

pub fn get_forward_template_quote_headline(&self) -> String

Trait Implementations§

Source§

impl Clone for AccountConfig

Source§

fn clone(&self) -> AccountConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccountConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AccountConfig

Source§

fn default() -> AccountConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AccountConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a AccountConfig> for Address<'a>

Source§

fn from(config: &'a AccountConfig) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AccountConfig

Source§

fn eq(&self, other: &AccountConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AccountConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AccountConfig

Source§

impl StructuralPartialEq for AccountConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

Source§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
Source§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
Source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
Source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
Source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,