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