Struct deltachat::imap::Imap

source ·
pub(crate) struct Imap {
    pub(crate) idle_interrupt_receiver: Receiver<()>,
    addr: String,
    lp: Vec<ConfiguredServerLoginParam>,
    password: String,
    proxy_config: Option<ProxyConfig>,
    strict_tls: bool,
    oauth2: bool,
    authentication_failed_once: bool,
    pub(crate) connectivity: ConnectivityStore,
    conn_last_try: Time,
    conn_backoff_ms: u64,
    ratelimit: Ratelimit,
}

Fields§

§idle_interrupt_receiver: Receiver<()>§addr: String

Email address.

§lp: Vec<ConfiguredServerLoginParam>

Login parameters.

§password: String

Password.

§proxy_config: Option<ProxyConfig>

Proxy configuration.

§strict_tls: bool§oauth2: bool§authentication_failed_once: bool§connectivity: ConnectivityStore§conn_last_try: Time§conn_backoff_ms: u64§ratelimit: Ratelimit

Rate limit for successful IMAP connections.

This rate limit prevents busy loop in case the server refuses logins or in case connection gets dropped over and over due to IMAP bug, e.g. the server returning invalid response to SELECT command immediately after logging in or returning an error in response to LOGIN command due to internal server error.

Implementations§

source§

impl Imap

source

pub(crate) async fn fake_idle( &mut self, context: &Context, watch_folder: String, ) -> Result<()>

Idle using polling.

source§

impl Imap

source

pub(crate) async fn scan_folders( &mut self, context: &Context, session: &mut Session, ) -> Result<bool>

Returns true if folders were scanned, false if scanning was postponed.

source§

impl Imap

source

pub fn new( lp: Vec<ConfiguredServerLoginParam>, password: String, proxy_config: Option<ProxyConfig>, addr: &str, strict_tls: bool, oauth2: bool, idle_interrupt_receiver: Receiver<()>, ) -> Self

Creates new disconnected IMAP client using the specific login parameters.

addr is used to renew token if OAuth2 authentication is used.

source

pub async fn new_configured( context: &Context, idle_interrupt_receiver: Receiver<()>, ) -> Result<Self>

Creates new disconnected IMAP client using configured parameters.

source

pub(crate) async fn connect( &mut self, context: &Context, configuring: bool, ) -> Result<Session>

Connects or reconnects if needed.

It is safe to call this function if already connected, actions are performed only as needed.

Calling this function is not enough to perform IMAP operations. Use Imap::prepare instead if you are going to actually use connection rather than trying connection parameters.

source

pub(crate) async fn prepare(&mut self, context: &Context) -> Result<Session>

Prepare for IMAP operation.

Ensure that IMAP client is connected, folders are created and IMAP capabilities are determined.

source

pub async fn fetch_move_delete( &mut self, context: &Context, session: &mut Session, watch_folder: &str, folder_meaning: FolderMeaning, ) -> Result<()>

FETCH-MOVE-DELETE iteration.

Prefetches headers and downloads new message from the folder, moves messages away from the folder and deletes messages in the folder.

source

pub(crate) async fn fetch_new_messages( &mut self, context: &Context, session: &mut Session, folder: &str, folder_meaning: FolderMeaning, fetch_existing_msgs: bool, ) -> Result<bool>

Fetches new messages.

Returns true if at least one message was fetched.

source

pub(crate) async fn fetch_existing_msgs( &mut self, context: &Context, session: &mut Session, ) -> Result<()>

Read the recipients from old emails sent by the user and add them as contacts. This way, we can already offer them some email addresses they can write to.

Then, Fetch the last messages DC_FETCH_EXISTING_MSGS_COUNT emails from the server and show them in the chat list.

source§

impl Imap

source

pub(crate) async fn configure_folders( &mut self, context: &Context, session: &mut Session, create_mvbox: bool, ) -> Result<()>

Trait Implementations§

source§

impl Debug for Imap

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Imap

§

impl !RefUnwindSafe for Imap

§

impl Send for Imap

§

impl Sync for Imap

§

impl !Unpin for Imap

§

impl !UnwindSafe for Imap

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> Same for T

source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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