1mail::account::readMessmaagielC:o:natcecnotu(n3tx)NativemaAiPlI::raecfceoruenntc:e:readMessageContent(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 mail::account *account;
40
41
42
43 account->readMessageContent (const std::vector<size_t> &msgList, bool
44 peek, mail::readMode requestType, myCallbackMessage &callback);
45
46
47
48 account->readMessageContent (size_t messageNum, bool peek,
49 mail::mimestruct &msginfo, mail::readMode requestType, myCallbackMes‐
50 sage &callback);
51
53 mail::account::readMessagesContent reads messages in the currently open
54 folder. There are two alternative versions of this method.
55
56 · The first version receives a list of message numbers. msgList speci‐
57 fies a list of messages. Messages are numbered starting with message
58 #0 and up to one less than mail::account::getFolderIndexSize(3x)()
59 (when mail::account::getFolderIndexSize returns 6, the messages are
60 numbered 0 through 5). Only the messages that appear in msgList are
61 processed by this request. This version is capable of returning
62 headers and/or content of multiple messages.
63
64 · The second version receives a single message number, and a
65 mail::mimestruct object that refers to a single MIME attachment or a
66 section of this message. The mail::account::MIMESTRUCTURE argument
67 to mail::account::readMessageAttributes(3x) returns a recursive tree
68 of mail::mimestruct objects which enumerates the individual MIME sec‐
69 tions in the message. msgInfo must be a reference to one of these
70 objects (or to a copy of these objects).
71
72 Setting peek to true does not reset the unread message status flag for
73 this message. Otherwise the unread message status flag will be reset.
74
75 Note: The application is notified about when a message's status
76 changes by by invoking the messageChanged callback method of the
77 currently opened folder's mail::folderCallback object. Depend‐
78 ing on the mail server, the messageChanged method may be invoked
79 as part of processing this request, or some time later after
80 this request is completed, and callback's success method was
81 invoked.
82
83 The mail::callback::message::messageTextCallback method receives the
84 requested content, which is determined by the remaining parameters.
85
86 requestType identifies the type of information to return from the
87 selected MIME section, and must be set to one of the following values:
88
89 mail::readHeadersFolded
90 Return only the headers of the MIME section. Folded headers are
91 unfolded (the newline and the leading space on the next line are
92 replaced with a single space character).
93
94 mail::readHeaders
95 Return only the headers of the MIME section. The headers are
96 returned as-is, without unfolding them.
97
98 mail::readContents
99 Return the content of the MIME section.
100
101 Note: The MIME section is not decoded. Check the Content-Trans‐
102 fer-Encoding header to know what you're getting.
103
104 mail::readBoth
105 Return the entire MIME section, as is: its headers, a blank
106 line, then the contents.
107
108 The callback method may not receive the entire requested content at
109 once. Typically the method will be invoked multiple times; each time
110 the method receives the next portion of the requested content. When
111 requesting headers and/or content of multiple messages, they may be
112 returned in any order, and the messageNumber parameter indicates which
113 message's contents are being returned (note, however, that the entire
114 contents of a given message are returned in their entirety, even when
115 the callback method gets invoked multiple times for that message,
116 before content from the next message are returned).
117
119 The application must wait until callback's success or fail method is
120 invoked. The success method is invoked when this request is succes‐
121 fully processed. The fail method is invoked if this request cannot be
122 processed. The application must not destroy callback until either the
123 success or fail method is invoked.
124
125 Note: callback's fail method may be invoked even after other
126 callback methods were invoked. This indicates that the request
127 was partially completed before the error was encountered.
128
129 Note: Multiple applications may have the same account and folder
130 opened at the same time. It is possible that a message refer‐
131 enced by this request was already deleted by another applica‐
132 tion. Depending on the underlying server implementation this
133 will result in either a failed request, invoking callback.fail,
134 or the request completing (callback.success invoked) but without
135 invoking any callback function that refer to the message.
136
138 mail::account::getFolderIndexSize(3x), mail::account::readMessageAt‐
139 tributes(3x), mail::account::readMessageContentDecoded(3x).
140
141
142
143 10 Aprilm2a0i0l6::account::readMessageContent(3x)