<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/> <title>mail::account::process</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="native.html" title="mail::account Native API reference"/> <link rel="prev" href="mail-poll.html" title="mail::account::poll"/> <link rel="next" href="mail-readmsgattr.html" title="mail::account::readMessageAttributes"/> <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::account::process</th> </tr> <tr> <td width="20%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="mail-poll.html" shape="rect">Prev</a> </td> <th width="60%" align="center" rowspan="1" colspan="1"> <span class="structname">mail::account</span> Native API reference</th> <td width="20%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="mail-readmsgattr.html" shape="rect">Next</a></td> </tr> </table> <hr/> </div> <div class="refentry" lang="en" xml:lang="en"> <a id="mail-process" shape="rect" name="mail-process"> </a> <div class="titlepage"/> <div class="refnamediv"> <h2>Name</h2> <p>mail::account::process — Process pending events</p> </div> <div class="refsynopsisdiv"> <h2>Synopsis</h2> <div class="literallayout"> <p><br clear="none"/> <br clear="none"/> <br clear="none"/> <br clear="none"/> #include <libmail/mail.H><br clear="none"/> <br clear="none"/> <br clear="none"/> class myCallback : public mail::callback {<br clear="none"/> public:<br clear="none"/>     void success(std::string msg);<br clear="none"/>     void fail(std::string msg);<br clear="none"/> };<br clear="none"/></p> </div> <div class="literallayout"> <p><br clear="none"/> #include <sys/time.h><br clear="none"/> #include <sys/types.h><br clear="none"/> #include <unistd.h><br clear="none"/> <br clear="none"/> mail::account::function( <em class="replaceable"><code>parameter list</code></em>,<br clear="none"/>                          myCallback &<em class="replaceable"><code>callback</code></em>)<br clear="none"/> <br clear="none"/> for (;;)<br clear="none"/> {<br clear="none"/>   std::vector<mail::pollfd> pollfds;<br clear="none"/>   int timeout;<br clear="none"/> <br clear="none"/>   timeout=15 * 60 * 60 * 1000;<br clear="none"/> </p> </div> <div class="funcsynopsis"> <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> <tr> <td rowspan="1" colspan="1"><code class="funcdef"><b class="fsfunc">mail::account::process</b>(</code></td> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"><var class="pdparam">pollfds</var>,</td> </tr> <tr> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"><var class="pdparam">timeout</var><code>)</code>;</td> </tr> </table> </div> <div class="literallayout"> <p><br clear="none"/> <br clear="none"/>   if (myCallback.completed())<br clear="none"/>       break;<br clear="none"/> <br clear="none"/>   if (mail::account::poll(pollfds, timeout) < 0 && errno != EINTR)<br clear="none"/>   {<br clear="none"/>      error();<br clear="none"/>   }<br clear="none"/> }<br clear="none"/></p> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id596934" shape="rect" name="id596934"> </a> <h2>USAGE</h2> <p>This function processes all pending events for all opened mail accounts. Most <span class="structname">mail</span> requests are not immediately processed (some are, but most aren't). A <span class="structname">mail</span> request usually includes a <span class="structname">mail::callback</span>-derived object as one of its arguments. When the mail request completes the <code class="function">success</code> or <code class="function">fail</code> method (some <span class="structname">mail::callback</span> subclasses use additional or alternative methods) is invoked. If the mail request cannot be completed immediately, <code class="function"><em class="replaceable"><code>mail::account::function</code></em></code> still returns right away. <code class="function">mail::account::process</code> handles any pending events for all outstanding <span class="structname">mail</span> requests. The <code class="function">success</code> or <code class="function">fail</code> method will be invoked for all completed requests.</p> <p>The <span class="structname">mail::pollfd</span> structure is a C++ wrapper for the “<span class="quote">struct <span class="structname">pollfd</span></span>” that's used by the <span class="citerefentry"><span class="refentrytitle">poll</span>(2)</span> system call. <code class="function">mail::account::process</code> receives a reference to a vector of <span class="structname">mail::pollfd</span> objects. After <code class="function">mail::account::process</code> handles any pending events, the function initializes the vector with all open file descriptors on which activity is expected before <code class="function">mail::account::process</code> expects any more events to occur.</p> <p>Any existing contents of the <span class="structname">mail::pollfd</span> vector will be destroyed. On the other hand, <em class="parameter"><code>timeout</code></em> must be initialized prior to invoking <code class="function">mail::account::process</code>. <em class="parameter"><code>timeout</code></em> contains a time interval, in milliseconds, before the calling application expects to process any regularly-scheduled event. If <code class="function">mail::account::process</code> expects any regularly-scheduled event to occur earlier, it will replace <em class="parameter"><code>timeout</code></em> with the smaller timeout interval.</p> <p>The expectation is that the application's main loops alternatively invokes <code class="function">mail::account::process</code> and <span class="citerefentry"><span class="refentrytitle">poll</span>(2)</span>. <span class="citerefentry"><span class="refentrytitle">poll</span>(2)</span> waits for some I/O occur, or a timeout expiring; <code class="function">mail::account::process</code> processes any resulting events, then the cycle repeats.</p> <p>The application may add its own file descriptors to the <span class="structname">mail::pollfd</span> vector, before calling <span class="citerefentry"><span class="refentrytitle">poll</span>(2)</span>. The application is reponsible for handling any I/O activity from its own file descriptors.</p> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id597140" shape="rect" name="id597140"> </a> <h2>Return Codes</h2> <p><code class="function">mail::account::process</code> always returns succesfully.</p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p>The application should not invoke <code class="function">mail::account::process</code> again until it either invokes <span class="citerefentry"><span class="refentrytitle">poll</span>(2)</span> (directly or via <a class="link" href="mail-poll.html" title="mail::account::poll" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::poll</span>(3x)</span></a>), or until the application calls another <span class="application">LibMAIL</span> function.</p> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id597206" shape="rect" name="id597206"> </a> <h2>SEE ALSO</h2> <p><a class="link" href="mail-open.html" title="mail::account::open" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::open</span>(3x)</span></a>, <a class="link" href="mail-poll.html" title="mail::account::poll" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::poll</span>(3x)</span></a>, <a class="link" href="mail-resume.html" title="mail::account::resume" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::resume</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="mail-poll.html" shape="rect">Prev</a> </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="u" href="native.html" shape="rect">Up</a></td> <td width="40%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="mail-readmsgattr.html" shape="rect">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top" rowspan="1" colspan="1">mail::account::poll </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"> mail::account::readMessageAttributes</td> </tr> </table> </div> </body> </html>