1MAIL::MIMESTRUCT(3x)    Cone: COnsole Newsreader And E    MAIL::MIMESTRUCT(3x)
2
3
4

NAME

6       mail::mimestruct - Message MIME structure
7

SYNOPSIS

9       #include <libmail/structure.H>
10
11       mail::mimestruct myMimeStructure;
12

USAGE

14       mail::mimestruct describes the contents of a MIME-formatted message. A
15       multipart MIME message has a single mail::mimestruct object that
16       represents the entire message, and series of mail::mimestruct objects,
17       one object for each part of the multipart MIME section. The additional
18       mail::mimestruct objects are maintained by their parent
19       mail::mimestruct object, and are automatically destroyed when the
20       parent object is destroyed.
21
22       A mail::mimestruct contains the following fields:
23
24       std::string mime_id
25           An opaque identifier of this MIME section. Applications should
26           handle this field as an opaque text string, which is interpreted by
27
28
29
30           LibMAIL . A same message, for example, may have different mime_id
31           fields if it comes from an IMAP account, or a POP3 account.
32
33           The only exception to this rule is that the mail::mimestruct object
34           that represents the entire message will have an empty string in
35           mime_id.
36
37       std::string type
38           The major MIME type, in uppercase.
39
40       std::string subtype
41           The minor MIME subtype, in uppercase.
42
43       mail::mimestruct::parameterList type_parameters
44           Additional attributes parsed from the Content-Type: MIME header.
45           See below for more information.
46
47       std::string content_id
48           The contents of the MIME Content-ID: header.
49
50       std::string content_description
51           The contents of the MIME Content-Description: header.
52
53       std::string content_transfer_encoding
54           The MIME encoding method.
55
56       std::string content_md5
57           The contents of the MIME Content-MD5: header.
58
59       std::string content_language
60           The contents of the MIME Content-Language: header.
61
62       std::string content_disposition
63           The MIME Content-Disposition: header, either "INLINE", or
64           "ATTACHMENT" (or blank, if the header is not present).
65
66       size_t content_size
67           The approximate size of the MIME section, in bytes (for
68           non-multipart MIME sections only).
69
70       size_t content_lines
71           Approximate number of lines in a TEXT MIME section.
72
73       mail::mimestruct::parameterList content_disposition_parameters
74           Additional attributes parsed from the Content-Disposition: MIME
75           header. See below for more information.
76
77   mail::mimestruct methods
78       bool flag=messagerfc822();
79           Returns true if type is "MESSAGE" and subtype is "RFC822".
80
81       bool flag=messagerfc822()
82           Returns true if type is "MESSAGE" and subtype is "RFC822".
83
84       mail::envelope &myEnvelope=getEnvelope()
85           Returns a mail::envelope object, if messagerfc822 returns true.
86
87       size_t numChildren=getNumChildren()
88           Returns the number of MIME sections in a multipart MIME message.
89
90       mail::mimestruct *child=getChild(size_t childNum)
91           Returns a pointer to a mail::mimestruct object that represents a
92           single part of a multipart MIME message.  childNum must be between
93           zero and one less than the number of parts returned by
94           getNumChildren.
95
96       mail::mimestruct *parent=getParent()
97           Returns a pointer to a mail::mimestruct object that represents the
98           parent of this MIME part, if this mail::mimestruct object
99           represents a single part of a multipart MIME message. Returns NULL
100           if this mail::mimestruct object represents the entire MIME message.
101
102           Note
103           mail::mimestruct objects that represent MESSAGE/RFC822 content
104           should have getNumChildren return 1, and getChild with childNum set
105           to 0 should return a pointer to a mail::mimestruct object that
106           represents the MESSAGE/RFC822 message. However, getNumChildren may
107           return 0 if the MIME message is corrupted.
108

MAIL::MIMESTRUCT::PARAMETERLIST

110       A mail::mimestruct::parameterList object holds parsed MIME attributes
111       in the Content-Type: and Content-Disposition: headers. A
112       mail::mimestruct::parameterList object has the following methods:
113
114       bool flag=exists(std::string name);
115           This method returns true if the attribute name exists.
116
117       std::string str=get(std::string name, const struct unicode_info
118       *info=NULL);
119           Returns the value of attribute name (uppercase). If info is not
120           NULL, the attribute´s value is converted to the specified character
121           set (if the attribute uses RFC 2231[1] to specify its character set
122           and language).
123
124       void set(std::string name, std::string value, std::string charset,
125       std::string language);
126           Set the attribute name to value. If charset and/or language are not
127           empty strings, name´s character set and language are indicated
128           accordingly, as per RFC 2231[1].
129
130       mail::mimestruct::parameterList::iterator begin(), end();
131       mail::mimestruct::parameterList::const_iterator begin() const, end()
132       const;
133           The begin and end functions return the equivalent iterators over
134           the individual name/value MIME attributes. The iterators point to a
135           std::pair<std::string, std::string>; first is the attribute name
136           (uppercased), and second is its value. (The underlying structure
137           being iterated is a std::map<std::string, std::string>.)
138

SEE ALSO

140       mail::envelope(3x), mail::account::readMessageAttributes(3x).
141

NOTES

143        1. RFC 2231
144           http://www.rfc-editor.org/rfc/rfc2231.txt
145
146
147
148[FIXME: source]                   05/08/2010              MAIL::MIMESTRUCT(3x)
Impressum