<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/> <title>mail::mimestruct</title> <link rel="stylesheet" href="manpage.css" type="text/css"/> <link rel="start" href="index.html" title="Cone: COnsole Newsreader And Emailer"/> <link rel="up" href="misc.html" title="Extra/Miscellaneous objects/methods"/> <link rel="prev" href="envelope.html" title="mail::envelope"/> <link rel="next" href="smap1.html" title="Appendix A. Simple Mail Access Protocol, Version 1"/> <link xmlns="" rel="icon" href="icon.gif" type="image/gif"/> <meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/> <!-- Copyright 2002 - 2007 Double Precision, Inc. See COPYING for distribution information. --> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center" rowspan="1"> mail::mimestruct</th> </tr> <tr> <td width="20%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="envelope.html" shape="rect">Prev</a> </td> <th width="60%" align="center" rowspan="1" colspan="1"> Extra/Miscellaneous objects/methods</th> <td width="20%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="smap1.html" shape="rect">Next</a></td> </tr> </table> <hr/> </div> <div class="refentry" lang="en" xml:lang="en"> <a id="mimestruct" shape="rect" name="mimestruct"> </a> <div class="titlepage"/> <div class="refnamediv"> <h2>Name</h2> <p>mail::mimestruct — Message MIME structure</p> </div> <div class="refsynopsisdiv"> <h2>Synopsis</h2> <div class="literallayout"> <p><br clear="none"/> #include <libmail/structure.H><br clear="none"/> <br clear="none"/> mail::mimestruct myMimeStructure;<br clear="none"/></p> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id643217" shape="rect" name="id643217"> </a> <h2>USAGE</h2> <p><span class="structname">mail::mimestruct</span> describes the contents of a MIME-formatted message. A multipart MIME message has a single <span class="structname">mail::mimestruct</span> object that represents the entire message, and series of <span class="structname">mail::mimestruct</span> objects, one object for each part of the multipart MIME section. The additional <span class="structname">mail::mimestruct</span> objects are maintained by their parent <span class="structname">mail::mimestruct</span> object, and are automatically destroyed when the parent object is destroyed.</p> <p>A <span class="structname">mail::mimestruct</span> contains the following fields:</p> <div class="variablelist"> <dl> <dt><span class="term">std::string mime_id</span></dt> <dd> <p>An opaque identifier of this MIME section. Applications should handle this field as an opaque text string, which is interpreted by <span class="application">LibMAIL</span> . A same message, for example, may have different <em class="structfield"><code>mime_id</code></em> fields if it comes from an IMAP account, or a POP3 account.</p> <p>The only exception to this rule is that the <span class="structname">mail::mimestruct</span> object that represents the entire message will have an empty string in <em class="structfield"><code>mime_id</code></em>.</p> </dd> <dt><span class="term">std::string type</span></dt> <dd> <p>The major MIME type, in uppercase.</p> </dd> <dt><span class="term">std::string subtype</span></dt> <dd> <p>The minor MIME subtype, in uppercase.</p> </dd> <dt><span class="term">mail::mimestruct::parameterList type_parameters</span></dt> <dd> <p>Additional attributes parsed from the <code class="literal">Content-Type:</code> MIME header. See below for more information.</p> </dd> <dt><span class="term">std::string content_id</span></dt> <dd> <p>The contents of the MIME <code class="literal">Content-ID:</code> header.</p> </dd> <dt><span class="term">std::string content_description</span></dt> <dd> <p>The contents of the MIME <code class="literal">Content-Description:</code> header.</p> </dd> <dt><span class="term">std::string content_transfer_encoding</span></dt> <dd> <p>The MIME encoding method.</p> </dd> <dt><span class="term">std::string content_md5</span></dt> <dd> <p>The contents of the MIME <code class="literal">Content-MD5:</code> header.</p> </dd> <dt><span class="term">std::string content_language</span></dt> <dd> <p>The contents of the MIME <code class="literal">Content-Language:</code> header.</p> </dd> <dt><span class="term">std::string content_disposition</span></dt> <dd> <p>The MIME <code class="literal">Content-Disposition:</code> header, either "<code class="literal">INLINE</code>", or "<code class="literal">ATTACHMENT</code>" (or blank, if the header is not present).</p> </dd> <dt><span class="term">size_t content_size</span></dt> <dd> <p>The approximate size of the MIME section, in bytes (for non-multipart MIME sections only).</p> </dd> <dt><span class="term">size_t content_lines</span></dt> <dd> <p>Approximate number of lines in a <code class="literal">TEXT</code> MIME section.</p> </dd> <dt><span class="term">mail::mimestruct::parameterList content_disposition_parameters</span></dt> <dd> <p>Additional attributes parsed from the <code class="literal">Content-Disposition:</code> MIME header. See below for more information.</p> </dd> </dl> </div> <div class="refsect2" lang="en" xml:lang="en"> <a id="id643526" shape="rect" name="id643526"> </a> <h3><span class="structname">mail::mimestruct</span> methods</h3> <div class="variablelist"> <dl> <dt><span class="term">bool flag=messagerfc822();</span></dt> <dd> <p>Returns <code class="literal">true</code> if <span class="structname">type</span> is "<code class="literal">MESSAGE</code>" and <span class="structname">subtype</span> is "<code class="literal">RFC822</code>".</p> </dd> <dt><span class="term">bool flag=messagerfc822()</span></dt> <dd> <p>Returns <code class="literal">true</code> if <span class="structname">type</span> is "<code class="literal">MESSAGE</code>" and <span class="structname">subtype</span> is "<code class="literal">RFC822</code>".</p> </dd> <dt><span class="term">mail::envelope &myEnvelope=getEnvelope()</span></dt> <dd> <p>Returns a <a class="link" href="envelope.html" title="mail::envelope" shape="rect"><span class="structname">mail::envelope</span></a> object, if <code class="function">messagerfc822</code> returns true.</p> </dd> <dt><span class="term">size_t numChildren=getNumChildren()</span></dt> <dd> <p>Returns the number of MIME sections in a multipart MIME message.</p> </dd> <dt><span class="term">mail::mimestruct *child=getChild(size_t childNum)</span></dt> <dd> <p>Returns a pointer to a <span class="structname">mail::mimestruct</span> object that represents a single part of a multipart MIME message. <em class="parameter"><code>childNum</code></em> must be between zero and one less than the number of parts returned by <code class="function">getNumChildren</code>.</p> </dd> <dt><span class="term">mail::mimestruct *parent=getParent()</span></dt> <dd> <p>Returns a pointer to a <span class="structname">mail::mimestruct</span> object that represents the parent of this MIME part, if this <span class="structname">mail::mimestruct</span> object represents a single part of a multipart MIME message. Returns NULL if this <span class="structname">mail::mimestruct</span> object represents the entire MIME message.</p> </dd> </dl> </div> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p><span class="structname">mail::mimestruct</span> objects that represent <code class="literal">MESSAGE/RFC822</code> content should have <code class="function">getNumChildren</code> return <code class="literal">1</code>, and <code class="function">getChild</code> with <em class="parameter"><code>childNum</code></em> set to <code class="literal">0</code> should return a pointer to a <span class="structname">mail::mimestruct</span> object that represents the <code class="literal">MESSAGE/RFC822</code> message. However, <code class="function">getNumChildren</code> may return 0 if the MIME message is corrupted.</p> </div> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id643778" shape="rect" name="id643778"> </a> <h2><span class="structname">mail::mimestruct::parameterList</span></h2> <p>A <span class="structname">mail::mimestruct::parameterList</span> object holds parsed MIME attributes in the <code class="literal">Content-Type:</code> and <code class="literal">Content-Disposition:</code> headers. A <span class="structname">mail::mimestruct::parameterList</span> object has the following methods:</p> <div class="variablelist"> <dl> <dt><span class="term">bool flag=exists(std::string name);</span></dt> <dd> <p>This method returns true if the attribute <em class="parameter"><code>name</code></em> exists.</p> </dd> <dt><span class="term">std::string str=get(std::string name, const struct unicode_info *info=NULL);</span></dt> <dd> <p>Returns the value of attribute <em class="parameter"><code>name</code></em> (uppercase). If <em class="parameter"><code>info</code></em> is not NULL, the attribute's value is converted to the specified character set (if the attribute uses <a class="ulink" href="http://www.rfc-editor.org/rfc/rfc2231.txt" target="_top" shape="rect">RFC 2231</a> to specify its character set and language).</p> </dd> <dt><span class="term">void set(std::string name, std::string value, std::string charset, std::string language);</span></dt> <dd> <p>Set the attribute <em class="parameter"><code>name</code></em> to <em class="parameter"><code>value</code></em>. If <em class="parameter"><code>charset</code></em> and/or <em class="parameter"><code>language</code></em> are not empty strings, <em class="parameter"><code>name</code></em>'s character set and language are indicated accordingly, as per <a class="ulink" href="http://www.rfc-editor.org/rfc/rfc2231.txt" target="_top" shape="rect">RFC 2231</a>.</p> </dd> <dt><span class="term">mail::mimestruct::parameterList::iterator begin(), end(); mail::mimestruct::parameterList::const_iterator begin() const, end() const;</span></dt> <dd> <p>The <code class="function">begin</code> and <code class="function">end</code> functions return the equivalent iterators over the individual name/value MIME attributes. The iterators point to a <span class="structname">std::pair<std::string, std::string></span>; <em class="structfield"><code>first</code></em> is the attribute name (uppercased), and <em class="structfield"><code>second</code></em> is its value. (The underlying structure being iterated is a <span class="structname">std::map<std::string, std::string></span>.)</p> </dd> </dl> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id643959" shape="rect" name="id643959"> </a> <h2>SEE ALSO</h2> <p><a class="link" href="envelope.html" title="mail::envelope" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::envelope</span>(3x)</span></a>, <a class="link" href="mail-readmsgattr.html" title="mail::account::readMessageAttributes" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::readMessageAttributes</span>(3x)</span></a>.</p> </div> </div> <div class="navfooter"> <hr/> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="envelope.html" shape="rect">Prev</a> </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="u" href="misc.html" shape="rect">Up</a></td> <td width="40%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="smap1.html" shape="rect">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top" rowspan="1" colspan="1">mail::envelope </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="h" href="index.html" shape="rect">Home</a> | <a accesskey="t" href="bk01-toc.html" shape="rect">ToC</a></td> <td width="40%" align="right" valign="top" rowspan="1" colspan="1"> Appendix A. Simple Mail Access Protocol, Version 1</td> </tr> </table> </div> </body> </html>