1MAIL::ACCOUNT::READM(3x)Cone: COnsole Newsreader And EMAIL::ACCOUNT::READM(3x)
2
3
4
6 mail::account::readMessageContent - Read messages
7
9 #include <libmail/mail.H>
10 #include <libmail/envelope.H>
11 #include <libmail/structure.H>
12
13 class myCallbackMessage : public mail::callback::message {
14 public:
15 void success(std::string msg);
16 void fail(std::string msg);
17
18 void messageEnvelopeCallback(size_t messageNumber,
19 const mail::envelope &envelopeArg);
20
21 void messageReferencesCallback(size_t messageNumber,
22 const std::vector<std::string> &referencesArg);
23
24 void messageArrivalDateCallback(size_t messageNumber,
25 time_t datetime);
26
27 void messageSizeCallback(size_t messageNumber,
28 unsigned long size);
29
30 void messageStructureCallback(size_t messageNumber,
31 const mail::mimestruct &messageStructure);
32 void messageTextCallback(size_t messageNumber, std::string text);
33 };
34
35 std::cout << (float)myMessageCallback.messageTextCompleted /
36 (float)myMessageCallback.messageTextEstimatedSize * 100
37 << "% completed." << endl;
38
39
40 mail::account *account;
41
42 account->readMessageContent(const std::vector<size_t> &msgList,
43 bool peek, mail::readMode requestType,
44 myCallbackMessage &callback);
45
46 account->readMessageContent(size_t messageNum, bool peek,
47 mail::mimestruct &msginfo,
48 mail::readMode requestType,
49 myCallbackMessage &callback);
50
52 mail::account::readMessagesContent reads messages in the currently open
53 folder. There are two alternative versions of this method.
54
55 · The first version receives a list of message numbers.
56
57
58
59 msgList specifies a list of messages. Messages are numbered
60 starting with message #0 and up to one less than
61 mail::account::getFolderIndexSize(3x)() (when
62 mail::account::getFolderIndexSize returns 6, the messages are
63 numbered 0 through 5). Only the messages that appear in msgList are
64 processed by this request. This version is capable of returning
65 headers and/or content of multiple messages.
66
67 · The second version receives a single message number, and a
68 mail::mimestruct object that refers to a single MIME attachment or
69 a section of this message. The mail::account::MIMESTRUCTURE
70 argument to mail::account::readMessageAttributes(3x) returns a
71 recursive tree of mail::mimestruct objects which enumerates the
72 individual MIME sections in the message. msgInfo must be a
73 reference to one of these objects (or to a copy of these objects).
74
75 Setting peek to true does not reset the unread message status flag for
76 this message. Otherwise the unread message status flag will be reset.
77
78 Note
79 The application is notified about when a message´s status changes
80 by by invoking the messageChanged callback method of the currently
81 opened folder´s mail::folderCallback object. Depending on the mail
82 server, the messageChanged method may be invoked as part of
83 processing this request, or some time later after this request is
84 completed, and callback´s success method was invoked.
85
86 The mail::callback::message::messageTextCallback method receives the
87 requested content, which is determined by the remaining parameters.
88
89 requestType identifies the type of information to return from the
90 selected MIME section, and must be set to one of the following values:
91
92 mail::readHeadersFolded
93 Return only the headers of the MIME section. Folded headers are
94 unfolded (the newline and the leading space on the next line are
95 replaced with a single space character).
96
97 mail::readHeaders
98 Return only the headers of the MIME section. The headers are
99 returned as-is, without unfolding them.
100
101 mail::readContents
102 Return the content of the MIME section.
103
104 Note
105 The MIME section is not decoded. Check the
106 Content-Transfer-Encoding header to know what you´re getting.
107
108 mail::readBoth
109 Return the entire MIME section, as is: its headers, a blank line,
110 then the contents.
111
112 The callback method may not receive the entire requested content at
113 once. Typically the method will be invoked multiple times; each time
114 the method receives the next portion of the requested content. When
115 requesting headers and/or content of multiple messages, they may be
116 returned in any order, and the messageNumber parameter indicates which
117 message´s contents are being returned (note, however, that the entire
118 contents of a given message are returned in their entirety, even when
119 the callback method gets invoked multiple times for that message,
120 before content from the next message are returned).
121
123 The application must wait until callback´s success or fail method is
124 invoked. The success method is invoked when this request is succesfully
125 processed. The fail method is invoked if this request cannot be
126 processed. The application must not destroy callback until either the
127 success or fail method is invoked.
128
129 Note
130 callback´s fail method may be invoked even after other callback
131 methods were invoked. This indicates that the request was partially
132 completed before the error was encountered.
133
134 Note
135 Multiple applications may have the same account and folder opened
136 at the same time. It is possible that a message referenced by this
137 request was already deleted by another application. Depending on
138 the underlying server implementation this will result in either a
139 failed request, invoking callback.fail, or the request completing
140 (callback.success invoked) but without invoking any callback
141 function that refer to the message.
142
144 mail::account::getFolderIndexSize(3x),
145 mail::account::readMessageAttributes(3x),
146 mail::account::readMessageContentDecoded(3x).
147
148
149
150[FIXME: source] 05/08/2010 MAIL::ACCOUNT::READM(3x)