Trait gmime::MessageExt [−][src]
pub trait MessageExt { fn add_mailbox(&self, type_: AddressType, name: &str, addr: &str); fn get_addresses(&self, type_: AddressType) -> Option<InternetAddressList>; fn get_all_recipients(&self) -> Option<InternetAddressList>; fn get_autocrypt_gossip_headers(
&self,
now: &DateTime,
flags: DecryptFlags,
session_key: &str
) -> Result<AutocryptHeaderList, Error>; fn get_autocrypt_gossip_headers_from_inner_part<P: IsA<Object>>(
&self,
now: &DateTime,
inner_part: &P
) -> Option<AutocryptHeaderList>; fn get_autocrypt_header(&self, now: &DateTime) -> Option<AutocryptHeader>; fn get_bcc(&self) -> Option<InternetAddressList>; fn get_body(&self) -> Option<Object>; fn get_cc(&self) -> Option<InternetAddressList>; fn get_date(&self) -> Option<DateTime>; fn get_from(&self) -> Option<InternetAddressList>; fn get_message_id(&self) -> Option<String>; fn get_mime_part(&self) -> Option<Object>; fn get_reply_to(&self) -> Option<InternetAddressList>; fn get_sender(&self) -> Option<InternetAddressList>; fn get_subject(&self) -> Option<String>; fn get_to(&self) -> Option<InternetAddressList>; fn split(&self, max_size: usize) -> Vec<Message>; fn set_date(&self, date: &DateTime); fn set_message_id(&self, message_id: &str); fn set_mime_part<P: IsA<Object>>(&self, mime_part: &P); fn set_subject(&self, subject: &str, charset: &str); }
Required Methods
fn add_mailbox(&self, type_: AddressType, name: &str, addr: &str)
Add a mailbox of a chosen type to the MIME message.
Note: The name
(and addr
) strings should be in UTF-8.
type_
A AddressType
name
The name of the mailbox (or None
)
addr
The address of the mailbox
fn get_addresses(&self, type_: AddressType) -> Option<InternetAddressList>
Gets a list of addresses of the specified type_
from the self
.
type_
A AddressType
Returns
a list of addresses of the specified
type_
from the self
.
fn get_all_recipients(&self) -> Option<InternetAddressList>
Gets the complete list of recipients for self
.
Returns
a newly allocated InternetAddressList
containing all recipients of the message or None
if no recipients
are set.
fn get_autocrypt_gossip_headers(
&self,
now: &DateTime,
flags: DecryptFlags,
session_key: &str
) -> Result<AutocryptHeaderList, Error>
&self,
now: &DateTime,
flags: DecryptFlags,
session_key: &str
) -> Result<AutocryptHeaderList, Error>
Creates a new AutocryptHeaderList
of relevant headers of the
given type based on the recipient(s) of an e-mail message.
Returns the same object as
g_mime_message_get_autocrypt_gossip_headers_with_inner_part
, but
handles decryption and cleanup automatically.
flags
and session_key
are passed through to
MultipartEncryptedExt::decrypt
, as needed.
If the message is not actually an encrypted message, returns None
:
it should be ignored for purposes of evaluating gossip.
If decryption fails, returns None
. In this case, an exception
will be set on err
to provide information about the decryption
failure.
now
a glib::DateTime
object, or None
flags
a DecryptFlags
, to be used during decryption
session_key
session key to use or None
Returns
a new AutocryptHeaderList
object,
or None
on error.
fn get_autocrypt_gossip_headers_from_inner_part<P: IsA<Object>>(
&self,
now: &DateTime,
inner_part: &P
) -> Option<AutocryptHeaderList>
&self,
now: &DateTime,
inner_part: &P
) -> Option<AutocryptHeaderList>
Creates a new AutocryptHeaderList
of relevant headers of the
given type based on the recipient(s) of an e-mail message.
You must pass the decrypted inner part of the message to this function, since Autocrypt-Gossip headers are only stored within the encrypted layer.
If you don't already have the decrypted inner part available to
you, you probably want to use
MessageExt::get_autocrypt_gossip_headers
instead.
Each header in the returned list will:
- have a valid address
- be of the type requested
- be complete
If no Autocrypt header is found for a recipient, no
AutocryptHeader
will be in the list associated with that e-mail address.
Note that the following types of Autocrypt headers will not be returned by this function:
- headers of an unrequested type
- headers that do not match an address in "From:"
- unparseable headers
- headers with unknown critical attributes
- duplicate valid headers for a given address
On error (e.g. if this version of GMime cannot handle the requested
Autocrypt type, or if a parameter is missing or malformed), returns
None
The returned Autocrypt headers will have their effective_date set to the earliest of either:
- the Date: header of the message or
now
(or the current time, ifnow
isNone
)
now
a glib::DateTime
object, or None
inner_part
a Object
which is the cleartext part of the inner message
Returns
a new AutocryptHeaderList
object, or None
on error.
fn get_autocrypt_header(&self, now: &DateTime) -> Option<AutocryptHeader>
Creates a new AutocryptHeader
base on the relevant Autocrypt
header associated with the sender of an e-mail message.
If the message has no sender in the From: field, or has more than
one sender, then this function will return None
. Autocrypt should
ignore the message entirely.
If there is one sender, but no single Autocrypt header is found
that matches that e-mail address, a AutocryptHeader
will be
returned for the sender, but it will be incomplete (see
AutocryptHeaderExt::is_complete
).
Note that the following types of Autocrypt headers will not be returned by this function:
- headers that do not match an address in "From:"
- unparseable headers
- headers with unknown critical attributes
- duplicate valid headers for the sender's address
The returned Autocrypt headers will have their effective_date set to the earliest of either:
- the Date: header of the message or
now
(or the current time, ifnow
isNone
)
now
a glib::DateTime
object, or None
Returns
a new AutocryptHeaderList
object,
or None
if the message should be ignored for purposes of
Autocrypt.
fn get_bcc(&self) -> Option<InternetAddressList>
Gets combined list of parsed addresses in the Bcc header(s).
Returns
the parsed list of addresses in the Bcc header(s).
fn get_body(&self) -> Option<Object>
Attempts to identify the MIME part containing the body of the message.
Returns
a Object
containing the textual
content that appears to be the main body of the message.
Note: This function is NOT guaranteed to always work as it makes some assumptions that are not necessarily true. It is recommended that you traverse the MIME structure yourself.
fn get_cc(&self) -> Option<InternetAddressList>
Gets combined list of parsed addresses in the Cc header(s).
Returns
the parsed list of addresses in the Cc header(s).
fn get_date(&self) -> Option<DateTime>
Gets the parsed date and time value from the Date header.
Returns
a glib::DateTime
on success or None
if the date could not be parsed.
fn get_from(&self) -> Option<InternetAddressList>
Gets the parsed list of addresses in the From header.
Returns
the parsed list of addresses in the From header.
fn get_message_id(&self) -> Option<String>
fn get_mime_part(&self) -> Option<Object>
fn get_reply_to(&self) -> Option<InternetAddressList>
Gets the parsed list of addresses in the Reply-To header.
Returns
the parsed list of addresses in the Reply-To header.
fn get_sender(&self) -> Option<InternetAddressList>
Gets the parsed list of addresses in the Sender header.
Returns
the parsed list of addresses in the Sender header.
fn get_subject(&self) -> Option<String>
Gets the subject of the self
.
Returns
the subject of the self
in a form suitable for display
or None
if no subject is set. If not None
, the returned string
will be in UTF-8.
fn get_to(&self) -> Option<InternetAddressList>
Gets combined list of parsed addresses in the To header(s).
Returns
the parsed list of addresses in the To header(s).
fn split(&self, max_size: usize) -> Vec<Message>
fn set_date(&self, date: &DateTime)
fn set_message_id(&self, message_id: &str)
fn set_mime_part<P: IsA<Object>>(&self, mime_part: &P)
fn set_subject(&self, subject: &str, charset: &str)
Implementors
impl<O: IsA<Message>> MessageExt for O