1MAIL::ACCOUNT::PROCE(3x)Cone: COnsole Newsreader And EMAIL::ACCOUNT::PROCE(3x)
2
3
4

NAME

6       mail::account::process - Process pending events
7

SYNOPSIS

9       #include <libmail/mail.H>
10
11
12       class myCallback : public mail::callback {
13       public:
14           void success(std::string msg);
15           void fail(std::string msg);
16       };
17
18       #include <sys/time.h>
19       #include <sys/types.h>
20       #include <unistd.h>
21
22       mail::account::function( parameter list,
23                                myCallback &callback)
24
25       for (;;)
26       {
27         std::vector<mail::pollfd> pollfds;
28         int timeout;
29
30         timeout=15 * 60 * 60 * 1000;
31
32       mail::account::process(pollfds, timeout);
33
34
35                                if (myCallback.completed())
36                                    break;
37
38                                if (mail::account::poll(pollfds, timeout) < 0 && errno != EINTR)
39                                {
40                                   error();
41                                }
42                              }
43

USAGE

45       This function processes all pending events for all opened mail
46       accounts. Most mail requests are not immediately processed (some are,
47       but most aren´t). A mail request usually includes a
48       mail::callback-derived object as one of its arguments. When the mail
49       request completes the success or fail method (some mail::callback
50       subclasses use additional or alternative methods) is invoked. If the
51       mail request cannot be completed immediately, mail::account::function
52       still returns right away.  mail::account::process handles any pending
53       events for all outstanding mail requests. The success or fail method
54       will be invoked for all completed requests.
55
56       The mail::pollfd structure is a C++ wrapper for the “struct pollfd”
57       that´s used by the poll(2) system call.  mail::account::process
58       receives a reference to a vector of mail::pollfd objects. After
59       mail::account::process handles any pending events, the function
60       initializes the vector with all open file descriptors on which activity
61       is expected before mail::account::process expects any more events to
62       occur.
63
64       Any existing contents of the mail::pollfd vector will be destroyed. On
65       the other hand, timeout must be initialized prior to invoking
66       mail::account::process.  timeout contains a time interval, in
67       milliseconds, before the calling application expects to process any
68       regularly-scheduled event. If mail::account::process expects any
69       regularly-scheduled event to occur earlier, it will replace timeout
70       with the smaller timeout interval.
71
72       The expectation is that the application´s main loops alternatively
73       invokes mail::account::process and poll(2).  poll(2) waits for some I/O
74       occur, or a timeout expiring; mail::account::process processes any
75       resulting events, then the cycle repeats.
76
77       The application may add its own file descriptors to the mail::pollfd
78       vector, before calling poll(2). The application is reponsible for
79       handling any I/O activity from its own file descriptors.
80

RETURN CODES

82       mail::account::process always returns succesfully.
83
84           Note
85           The application should not invoke mail::account::process again
86           until it either invokes poll(2) (directly or via
87           mail::account::poll(3x)), or until the application calls another
88
89
90
91           LibMAIL function.
92

SEE ALSO

94       mail::account::open(3x), mail::account::poll(3x),
95       mail::account::resume(3x).
96
97
98
99[FIXME: source]                   05/08/2010          MAIL::ACCOUNT::PROCE(3x)
Impressum