diff options
author | Vincent Richard <[email protected]> | 2013-11-14 22:17:40 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-14 22:17:40 +0000 |
commit | 5915ca4e34d2192cb3ef06c8f47aaa4b16cf7f53 (patch) | |
tree | df93293cf51e856abb91d8391cea9242362cefd7 /doc/book/net.tex | |
parent | Added missing export specifiers. (diff) | |
download | vmime-5915ca4e34d2192cb3ef06c8f47aaa4b16cf7f53.tar.gz vmime-5915ca4e34d2192cb3ef06c8f47aaa4b16cf7f53.zip |
Custom fetch attributes.
Diffstat (limited to '')
-rw-r--r-- | doc/book/net.tex | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/doc/book/net.tex b/doc/book/net.tex index 8b1c7fa7..88249c1c 100644 --- a/doc/book/net.tex +++ b/doc/book/net.tex @@ -560,8 +560,8 @@ std::vector <ref <vmime::net::message> > allMessages = // -1 is a special value to mean "the number of the last message in the folder" folder->fetchMessages(allMessages, - vmime::net::folder::FETCH_FLAGS | - vmime::net::folder::FETCH_ENVELOPE); + vmime::net::fetchAttributes::FLAGS | + vmime::net::fetchAttributes::ENVELOPE); for (unsigned int i = 0 ; i < allMessages.size() ; ++i) { @@ -583,6 +583,21 @@ for (unsigned int i = 0 ; i < allMessages.size() ; ++i) } \end{lstlisting} +IMAP supports fetching specific header fields of a message. Here is how to use +the {\vcode fetchAttributes} object to do it: + +\begin{lstlisting}[caption={Using fetchAttributes object to fetch specific header fields of a message}] + +// Fetch message flags and the "Received" and "X-Mailer" header fields +vmime::net::fetchAttributes fetchAttribs; +fetchAttribs.add(vmime::net::fetchAttributes::FLAGS); +fetchAttribs.add("Received"); +fetchAttribs.add("X-Mailer"); + +folder->fetchMessages(allMessages, fetchAttribs); +\end{lstlisting} + + \subsection{Extracting messages and parts} To extract the whole contents of a message (including headers), use the @@ -605,7 +620,7 @@ and time. The method {\vcode extractPart()} is used in this case: \begin{lstlisting}[caption={Extracting a specific MIME part of a message}] // Fetching structure is required before extracting a part -folder->fetchMessage(msg, vmime::net::folder::FETCH_STRUCTURE); +folder->fetchMessage(msg, vmime::net::fetchAttributes::STRUCTURE); // Now, we can extract the part msg->extractPart(msg->getStructure()->getPartAt(0)->getPartAt(1)); |