mail::mimestruct — Message MIME structure
#include <libmail/structure.H>
mail::mimestruct myMimeStructure;
mail::mimestruct describes the contents of a MIME-formatted message. A multipart MIME message has a single mail::mimestruct object that represents the entire message, and series of mail::mimestruct objects, one object for each part of the multipart MIME section. The additional mail::mimestruct objects are maintained by their parent mail::mimestruct object, and are automatically destroyed when the parent object is destroyed.
A mail::mimestruct contains the following fields:
An opaque identifier of this MIME section.
Applications should handle this field as an opaque text
string, which is interpreted by LibMAIL . A same message, for
example, may have different mime_id
fields if it
comes from an IMAP account, or a POP3 account.
The only exception to this rule is that the
mail::mimestruct object
that represents the entire message will have an empty
string in mime_id
.
The major MIME type, in uppercase.
The minor MIME subtype, in uppercase.
Additional attributes parsed from the Content-Type:
MIME header. See below
for more information.
The contents of the MIME Content-ID:
header.
The contents of the MIME Content-Description:
header.
The MIME encoding method.
The contents of the MIME Content-MD5:
header.
The contents of the MIME Content-Language:
header.
The MIME Content-Disposition:
header, either
"INLINE
", or "ATTACHMENT
" (or blank, if the header
is not present).
The approximate size of the MIME section, in bytes (for non-multipart MIME sections only).
Approximate number of lines in a TEXT
MIME section.
Additional attributes parsed from the Content-Disposition:
MIME header. See
below for more information.
Returns true
if
type is "MESSAGE
" and subtype is "RFC822
".
Returns true
if
type is "MESSAGE
" and subtype is "RFC822
".
Returns a mail::envelope object, if
messagerfc822
returns
true.
Returns the number of MIME sections in a multipart MIME message.
Returns a pointer to a mail::mimestruct object that
represents a single part of a multipart MIME message.
childNum
must
be between zero and one less than the number of parts
returned by getNumChildren
.
Returns a pointer to a mail::mimestruct object that represents the parent of this MIME part, if this mail::mimestruct object represents a single part of a multipart MIME message. Returns NULL if this mail::mimestruct object represents the entire MIME message.
mail::mimestruct
objects that represent MESSAGE/RFC822
content should have
getNumChildren
return
1
, and getChild
with childNum
set to
0
should return a pointer to
a mail::mimestruct object
that represents the MESSAGE/RFC822
message. However,
getNumChildren
may return 0
if the MIME message is corrupted.
A mail::mimestruct::parameterList object
holds parsed MIME attributes in the Content-Type:
and Content-Disposition:
headers. A mail::mimestruct::parameterList object
has the following methods:
This method returns true if the attribute name
exists.
Returns the value of attribute name
(uppercase). If
info
is not
NULL, the attribute's value is converted to the
specified character set (if the attribute uses
RFC 2231 to specify its
character set and language).
Set the attribute name
to value
. If charset
and/or language
are not empty
strings, name
's
character set and language are indicated accordingly,
as per RFC 2231.
The begin
and
end
functions return the
equivalent iterators over the individual name/value
MIME attributes. The iterators point to a std::pair<std::string,
std::string>; first
is the attribute
name (uppercased), and second
is its value.
(The underlying structure being iterated is a
std::map<std::string,
std::string>.)