pub struct ReplyContext {
pub thread_id: String,
pub message_id: Option<String>,
pub references: Vec<String>,
pub in_reply_to: Vec<String>,
pub subject: String,
pub from: Vec<Mailbox>,
pub reply_to: Vec<Mailbox>,
pub to: Vec<Mailbox>,
pub cc: Vec<Mailbox>,
pub sent_by_me: bool,
pub skipped: Vec<(&'static str, String)>,
}Expand description
What a reply needs from the message it replies to.
Fields§
§thread_id: StringGmail thread id of the original. Goes on the draft’s message, not
in a header.
message_id: Option<String>The original’s Message-ID, without angle brackets.
references: Vec<String>The original’s References, without angle brackets, in order.
in_reply_to: Vec<String>The original’s In-Reply-To, without angle brackets.
subject: StringThe original’s Subject, or empty.
from: Vec<Mailbox>The original’s From.
reply_to: Vec<Mailbox>The original’s Reply-To.
to: Vec<Mailbox>The original’s To.
cc: Vec<Mailbox>The original’s Cc.
sent_by_me: boolWhether the account sent the original (Gmail’s SENT label, which
also covers send-as aliases).
skipped: Vec<(&'static str, String)>Addresses in the original’s address headers that could not be used,
as (header, address), for the caller to warn about.
Implementations§
Source§impl ReplyContext
impl ReplyContext
Sourcepub fn from_message(message: &Message) -> Result<Self>
pub fn from_message(message: &Message) -> Result<Self>
Reads the reply context from a message fetched with
format=metadata and REPLY_HEADERS.
Sourcepub fn default_recipients(
&self,
reply_all: bool,
exclude: &[String],
) -> (Vec<Mailbox>, Vec<Mailbox>)
pub fn default_recipients( &self, reply_all: bool, exclude: &[String], ) -> (Vec<Mailbox>, Vec<Mailbox>)
The reply’s To and Cc when the caller names nobody (#1954).
A plain reply goes to the original’s Reply-To, else its From; a
reply to a message the account sent goes to that message’s To
instead, as in Gmail’s UI. reply_all adds the original’s To to the
reply’s To and its Cc to the reply’s Cc, keeping each recipient
in the header they were in. The addresses in exclude (the account’s
own, and any the caller has already placed) are left out, as are
repeats, both compared case-insensitively and keeping the first
occurrence (To before Cc).
Either list can come back empty, To included: deciding what that
means is the caller’s job.
Sourcepub fn reply_references(&self) -> Vec<String>
pub fn reply_references(&self) -> Vec<String>
The reply’s References: the original’s References (or, lacking
those, its In-Reply-To) followed by the original’s Message-ID,
per RFC 5322 §3.6.4. Duplicates are dropped, keeping the first.
Sourcepub fn reply_subject(&self) -> String
pub fn reply_subject(&self) -> String
Re: <original subject>, unless the original already starts with a
Re: (any case, Re : too), so replies don’t stack Re: Re:.
Trait Implementations§
Source§impl Clone for ReplyContext
impl Clone for ReplyContext
Source§impl Debug for ReplyContext
impl Debug for ReplyContext
Source§impl Default for ReplyContext
impl Default for ReplyContext
impl Eq for ReplyContext
Source§impl PartialEq for ReplyContext
impl PartialEq for ReplyContext
impl StructuralPartialEq for ReplyContext
Auto Trait Implementations§
impl Freeze for ReplyContext
impl RefUnwindSafe for ReplyContext
impl Send for ReplyContext
impl Sync for ReplyContext
impl Unpin for ReplyContext
impl UnsafeUnpin for ReplyContext
impl UnwindSafe for ReplyContext
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