author | alwin <alwin> | 2003-12-21 21:33:49 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-21 21:33:49 (UTC) |
commit | 6e7358f954618d8fdbbe852df7df862c3c132bbd (patch) (unidiff) | |
tree | 0e2a94a0a42393b811d85172677c117517db5fd4 /noncore/net/mail/libmailwrapper | |
parent | fafcc882ba0d797d5aa8ed7f2f8d5518ba6d2960 (diff) | |
download | opie-6e7358f954618d8fdbbe852df7df862c3c132bbd.zip opie-6e7358f954618d8fdbbe852df7df862c3c132bbd.tar.gz opie-6e7358f954618d8fdbbe852df7df862c3c132bbd.tar.bz2 |
- mbox-wrapper mostly finished
- special-folders "Local Folders" will be displayed
ToDo:
"STORE" - method for all wrapper, but mostly for mbox for
send queue.
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 393 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 59 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 418 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 43 |
6 files changed, 479 insertions, 443 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 3cb8f7d..416795b 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -2,4 +2,5 @@ | |||
2 | #include "imapwrapper.h" | 2 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "mboxwrapper.h" | ||
4 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
5 | 6 | ||
@@ -21,4 +22,9 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a) | |||
21 | } | 22 | } |
22 | 23 | ||
24 | AbstractMail* AbstractMail::getWrapper(const QString&a) | ||
25 | { | ||
26 | return new MBOXwrapper(a); | ||
27 | } | ||
28 | |||
23 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
24 | { | 30 | { |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 8dd2e12..509b68e 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -28,7 +28,10 @@ public: | |||
28 | virtual void deleteMail(const RecMail&mail)=0; | 28 | virtual void deleteMail(const RecMail&mail)=0; |
29 | virtual void answeredMail(const RecMail&mail)=0; | 29 | virtual void answeredMail(const RecMail&mail)=0; |
30 | virtual void cleanMimeCache(){}; | ||
30 | 31 | ||
31 | static AbstractMail* getWrapper(IMAPaccount *a); | 32 | static AbstractMail* getWrapper(IMAPaccount *a); |
32 | static AbstractMail* getWrapper(POP3account *a); | 33 | static AbstractMail* getWrapper(POP3account *a); |
34 | /* mbox only! */ | ||
35 | static AbstractMail* getWrapper(const QString&a); | ||
33 | 36 | ||
34 | protected: | 37 | protected: |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp new file mode 100644 index 0000000..447cad0 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -0,0 +1,393 @@ | |||
1 | #include "genericwrapper.h" | ||
2 | #include <libetpan/mailmime.h> | ||
3 | #include <libetpan/data_message_driver.h> | ||
4 | #include "mailtypes.h" | ||
5 | |||
6 | Genericwrapper::Genericwrapper() | ||
7 | : AbstractMail() | ||
8 | { | ||
9 | bodyCache.clear(); | ||
10 | } | ||
11 | |||
12 | Genericwrapper::~Genericwrapper() | ||
13 | { | ||
14 | cleanMimeCache(); | ||
15 | } | ||
16 | |||
17 | void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | ||
18 | { | ||
19 | if (!mime) { | ||
20 | return; | ||
21 | } | ||
22 | mailmime_field*field = 0; | ||
23 | mailmime_single_fields fields; | ||
24 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
25 | if (mime->mm_mime_fields != NULL) { | ||
26 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
27 | mime->mm_content_type); | ||
28 | } | ||
29 | |||
30 | mailmime_content*type = fields.fld_content; | ||
31 | clistcell*current; | ||
32 | if (!type) { | ||
33 | target.setType("text"); | ||
34 | target.setSubtype("plain"); | ||
35 | } else { | ||
36 | target.setSubtype(type->ct_subtype); | ||
37 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | ||
38 | case MAILMIME_DISCRETE_TYPE_TEXT: | ||
39 | target.setType("text"); | ||
40 | break; | ||
41 | case MAILMIME_DISCRETE_TYPE_IMAGE: | ||
42 | target.setType("image"); | ||
43 | break; | ||
44 | case MAILMIME_DISCRETE_TYPE_AUDIO: | ||
45 | target.setType("audio"); | ||
46 | break; | ||
47 | case MAILMIME_DISCRETE_TYPE_VIDEO: | ||
48 | target.setType("video"); | ||
49 | break; | ||
50 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | ||
51 | target.setType("application"); | ||
52 | break; | ||
53 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | ||
54 | default: | ||
55 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { | ||
56 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); | ||
57 | } | ||
58 | break; | ||
59 | } | ||
60 | if (type->ct_parameters) { | ||
61 | fillParameters(target,type->ct_parameters); | ||
62 | } | ||
63 | } | ||
64 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { | ||
65 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { | ||
66 | field = (mailmime_field*)current->data; | ||
67 | switch(field->fld_type) { | ||
68 | case MAILMIME_FIELD_TRANSFER_ENCODING: | ||
69 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); | ||
70 | break; | ||
71 | case MAILMIME_FIELD_ID: | ||
72 | target.setIdentifier(field->fld_data.fld_id); | ||
73 | break; | ||
74 | case MAILMIME_FIELD_DESCRIPTION: | ||
75 | target.setDescription(field->fld_data.fld_description); | ||
76 | break; | ||
77 | default: | ||
78 | break; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | |||
84 | void Genericwrapper::fillParameters(RecPart&target,clist*parameters) | ||
85 | { | ||
86 | if (!parameters) {return;} | ||
87 | clistcell*current=0; | ||
88 | mailmime_parameter*param; | ||
89 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { | ||
90 | param = (mailmime_parameter*)current->data; | ||
91 | if (param) { | ||
92 | target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | ||
98 | { | ||
99 | QString enc="7bit"; | ||
100 | if (!aEnc) return enc; | ||
101 | switch(aEnc->enc_type) { | ||
102 | case MAILMIME_MECHANISM_7BIT: | ||
103 | enc = "7bit"; | ||
104 | break; | ||
105 | case MAILMIME_MECHANISM_8BIT: | ||
106 | enc = "8bit"; | ||
107 | break; | ||
108 | case MAILMIME_MECHANISM_BINARY: | ||
109 | enc = "binary"; | ||
110 | break; | ||
111 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: | ||
112 | enc = "quoted-printable"; | ||
113 | break; | ||
114 | case MAILMIME_MECHANISM_BASE64: | ||
115 | enc = "base64"; | ||
116 | break; | ||
117 | case MAILMIME_MECHANISM_TOKEN: | ||
118 | default: | ||
119 | if (aEnc->enc_token) { | ||
120 | enc = QString(aEnc->enc_token); | ||
121 | } | ||
122 | break; | ||
123 | } | ||
124 | return enc; | ||
125 | } | ||
126 | |||
127 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) | ||
128 | { | ||
129 | if (current_rec >= 10) { | ||
130 | qDebug("too deep recursion!"); | ||
131 | } | ||
132 | if (!message || !mime) { | ||
133 | return; | ||
134 | } | ||
135 | int r; | ||
136 | char*data = 0; | ||
137 | size_t len; | ||
138 | clistiter * cur = 0; | ||
139 | QString b; | ||
140 | RecPart part; | ||
141 | |||
142 | switch (mime->mm_type) { | ||
143 | case MAILMIME_SINGLE: | ||
144 | r = mailmessage_fetch_section(message,mime,&data,&len); | ||
145 | part.setSize(len); | ||
146 | fillSingleBody(part,message,mime); | ||
147 | if (part.Type()=="text" && target.Bodytext().isNull()) { | ||
148 | encodedString*r = new encodedString(); | ||
149 | r->setContent(data,len); | ||
150 | encodedString*res = decode_String(r,part.Encoding()); | ||
151 | b = QString(res->Content()); | ||
152 | delete r; | ||
153 | delete res; | ||
154 | target.setBodytext(b); | ||
155 | target.setDescription(part); | ||
156 | } else { | ||
157 | b = gen_attachment_id(); | ||
158 | part.setIdentifier(b); | ||
159 | bodyCache[b]=new encodedString(data,len); | ||
160 | target.addPart(part); | ||
161 | } | ||
162 | break; | ||
163 | case MAILMIME_MULTIPLE: | ||
164 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | ||
165 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); | ||
166 | } | ||
167 | break; | ||
168 | case MAILMIME_MESSAGE: | ||
169 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | ||
170 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); | ||
171 | } | ||
172 | break; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | RecBody Genericwrapper::parseMail( mailmessage * msg ) | ||
177 | { | ||
178 | int err = MAILIMF_NO_ERROR; | ||
179 | mailmime_single_fields fields; | ||
180 | /* is bound to msg and will be freed there */ | ||
181 | mailmime * mime=0; | ||
182 | RecBody body; | ||
183 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
184 | err = mailmessage_get_bodystructure(msg,&mime); | ||
185 | traverseBody(body,msg,mime); | ||
186 | return body; | ||
187 | } | ||
188 | |||
189 | RecMail *Genericwrapper::parseHeader( const char *header ) | ||
190 | { | ||
191 | int err = MAILIMF_NO_ERROR; | ||
192 | size_t curTok = 0; | ||
193 | RecMail *mail = new RecMail(); | ||
194 | mailimf_fields *fields; | ||
195 | mailimf_references * refs; | ||
196 | mailimf_keywords*keys; | ||
197 | QString status; | ||
198 | QString value; | ||
199 | QBitArray mFlags(7); | ||
200 | |||
201 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); | ||
202 | for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) { | ||
203 | mailimf_field *field = (mailimf_field *) current->data; | ||
204 | switch ( field->fld_type ) { | ||
205 | case MAILIMF_FIELD_FROM: | ||
206 | mail->setFrom( parseMailboxList( field->fld_data.fld_from->frm_mb_list ) ); | ||
207 | break; | ||
208 | case MAILIMF_FIELD_TO: | ||
209 | mail->setTo( parseAddressList( field->fld_data.fld_to->to_addr_list ) ); | ||
210 | break; | ||
211 | case MAILIMF_FIELD_CC: | ||
212 | mail->setCC( parseAddressList( field->fld_data.fld_cc->cc_addr_list ) ); | ||
213 | break; | ||
214 | case MAILIMF_FIELD_BCC: | ||
215 | mail->setBcc( parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) ); | ||
216 | break; | ||
217 | case MAILIMF_FIELD_SUBJECT: | ||
218 | mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); | ||
219 | break; | ||
220 | case MAILIMF_FIELD_ORIG_DATE: | ||
221 | mail->setDate( parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) ); | ||
222 | break; | ||
223 | case MAILIMF_FIELD_MESSAGE_ID: | ||
224 | mail->setMsgid(QString(field->fld_data.fld_message_id->mid_value)); | ||
225 | break; | ||
226 | case MAILIMF_FIELD_REFERENCES: | ||
227 | refs = field->fld_data.fld_references; | ||
228 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
229 | char * text = (char*)refs->mid_list->first->data; | ||
230 | mail->setReplyto(QString(text)); | ||
231 | } | ||
232 | break; | ||
233 | case MAILIMF_FIELD_KEYWORDS: | ||
234 | keys = field->fld_data.fld_keywords; | ||
235 | for (clistcell*cur = clist_begin(keys->kw_list);cur!=0;cur=clist_next(cur)) { | ||
236 | qDebug("Keyword: %s",(char*)cur->data); | ||
237 | } | ||
238 | break; | ||
239 | case MAILIMF_FIELD_OPTIONAL_FIELD: | ||
240 | status = field->fld_data.fld_optional_field->fld_name; | ||
241 | value = field->fld_data.fld_optional_field->fld_value; | ||
242 | if (status.lower()=="status") { | ||
243 | if (value.lower()=="ro") { | ||
244 | mFlags.setBit(FLAG_SEEN); | ||
245 | } | ||
246 | } else if (status.lower()=="x-status") { | ||
247 | qDebug("X-Status: %s",value.latin1()); | ||
248 | if (value.lower()=="a") { | ||
249 | mFlags.setBit(FLAG_ANSWERED); | ||
250 | } | ||
251 | } else { | ||
252 | // qDebug("Optionales feld: %s -> %s)",field->fld_data.fld_optional_field->fld_name, | ||
253 | // field->fld_data.fld_optional_field->fld_value); | ||
254 | } | ||
255 | break; | ||
256 | default: | ||
257 | qDebug("Non parsed field"); | ||
258 | break; | ||
259 | } | ||
260 | } | ||
261 | if (fields) mailimf_fields_free(fields); | ||
262 | mail->setFlags(mFlags); | ||
263 | return mail; | ||
264 | } | ||
265 | |||
266 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | ||
267 | { | ||
268 | char tmp[23]; | ||
269 | |||
270 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | ||
271 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
272 | |||
273 | return QString( tmp ); | ||
274 | } | ||
275 | |||
276 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | ||
277 | { | ||
278 | QString result( "" ); | ||
279 | |||
280 | bool first = true; | ||
281 | if (list == 0) return result; | ||
282 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | ||
283 | mailimf_address *addr = (mailimf_address *) current->data; | ||
284 | |||
285 | if ( !first ) { | ||
286 | result.append( "," ); | ||
287 | } else { | ||
288 | first = false; | ||
289 | } | ||
290 | |||
291 | switch ( addr->ad_type ) { | ||
292 | case MAILIMF_ADDRESS_MAILBOX: | ||
293 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | ||
294 | break; | ||
295 | case MAILIMF_ADDRESS_GROUP: | ||
296 | result.append( parseGroup( addr->ad_data.ad_group ) ); | ||
297 | break; | ||
298 | default: | ||
299 | qDebug( "Generic: unkown mailimf address type" ); | ||
300 | break; | ||
301 | } | ||
302 | } | ||
303 | |||
304 | return result; | ||
305 | } | ||
306 | |||
307 | QString Genericwrapper::parseGroup( mailimf_group *group ) | ||
308 | { | ||
309 | QString result( "" ); | ||
310 | |||
311 | result.append( group->grp_display_name ); | ||
312 | result.append( ": " ); | ||
313 | |||
314 | if ( group->grp_mb_list != NULL ) { | ||
315 | result.append( parseMailboxList( group->grp_mb_list ) ); | ||
316 | } | ||
317 | |||
318 | result.append( ";" ); | ||
319 | |||
320 | return result; | ||
321 | } | ||
322 | |||
323 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | ||
324 | { | ||
325 | QString result( "" ); | ||
326 | |||
327 | if ( box->mb_display_name == NULL ) { | ||
328 | result.append( box->mb_addr_spec ); | ||
329 | } else { | ||
330 | result.append( convert_String(box->mb_display_name).latin1() ); | ||
331 | result.append( " <" ); | ||
332 | result.append( box->mb_addr_spec ); | ||
333 | result.append( ">" ); | ||
334 | } | ||
335 | |||
336 | return result; | ||
337 | } | ||
338 | |||
339 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | ||
340 | { | ||
341 | QString result( "" ); | ||
342 | |||
343 | bool first = true; | ||
344 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | ||
345 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | ||
346 | |||
347 | if ( !first ) { | ||
348 | result.append( "," ); | ||
349 | } else { | ||
350 | first = false; | ||
351 | } | ||
352 | |||
353 | result.append( parseMailbox( box ) ); | ||
354 | } | ||
355 | |||
356 | return result; | ||
357 | } | ||
358 | |||
359 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | ||
360 | { | ||
361 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | ||
362 | if (it==bodyCache.end()) return new encodedString(); | ||
363 | encodedString*t = decode_String(it.data(),part.Encoding()); | ||
364 | return t; | ||
365 | } | ||
366 | |||
367 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | ||
368 | { | ||
369 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | ||
370 | if (it==bodyCache.end()) return new encodedString(); | ||
371 | encodedString*t = it.data(); | ||
372 | return t; | ||
373 | } | ||
374 | |||
375 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | ||
376 | { | ||
377 | encodedString*t = fetchDecodedPart(mail,part); | ||
378 | QString text=t->Content(); | ||
379 | delete t; | ||
380 | return text; | ||
381 | } | ||
382 | |||
383 | void Genericwrapper::cleanMimeCache() | ||
384 | { | ||
385 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | ||
386 | for (;it!=bodyCache.end();++it) { | ||
387 | encodedString*t = it.data(); | ||
388 | //it.setValue(0); | ||
389 | if (t) delete t; | ||
390 | } | ||
391 | bodyCache.clear(); | ||
392 | qDebug("Genericwrapper: cache cleaned"); | ||
393 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h new file mode 100644 index 0000000..12f6928 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef __GENERIC_WRAPPER_H | ||
2 | #define __GENERIC_WRAPPER_H | ||
3 | |||
4 | #include "abstractmail.h" | ||
5 | #include <qmap.h> | ||
6 | #include <qstring.h> | ||
7 | #include <libetpan/clist.h> | ||
8 | |||
9 | class RecMail; | ||
10 | class RecBody; | ||
11 | class encodedString; | ||
12 | struct mailpop3; | ||
13 | struct mailmessage; | ||
14 | struct mailmime; | ||
15 | struct mailmime_mechanism; | ||
16 | struct mailimf_mailbox_list; | ||
17 | struct mailimf_mailbox; | ||
18 | struct mailimf_date_time; | ||
19 | struct mailimf_group; | ||
20 | struct mailimf_address_list; | ||
21 | |||
22 | /* this class hold just the funs shared between | ||
23 | * mbox and pop3 (later mh, too) mail access. | ||
24 | * it is not desigend to make a instance of it! | ||
25 | */ | ||
26 | class Genericwrapper : public AbstractMail | ||
27 | { | ||
28 | Q_OBJECT | ||
29 | public: | ||
30 | Genericwrapper(); | ||
31 | virtual ~Genericwrapper(); | ||
32 | |||
33 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | ||
34 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | ||
35 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | ||
36 | virtual void cleanMimeCache(); | ||
37 | |||
38 | protected: | ||
39 | RecMail *parseHeader( const char *header ); | ||
40 | RecBody parseMail( mailmessage * msg ); | ||
41 | QString parseMailboxList( mailimf_mailbox_list *list ); | ||
42 | QString parseMailbox( mailimf_mailbox *box ); | ||
43 | QString parseGroup( mailimf_group *group ); | ||
44 | QString parseAddressList( mailimf_address_list *list ); | ||
45 | QString parseDateTime( mailimf_date_time *date ); | ||
46 | |||
47 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); | ||
48 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | ||
49 | static void fillParameters(RecPart&target,clist*parameters); | ||
50 | static QString getencoding(mailmime_mechanism*aEnc); | ||
51 | |||
52 | POP3account *account; | ||
53 | mailpop3 *m_pop3; | ||
54 | QString msgTempName; | ||
55 | unsigned int last_msg_id; | ||
56 | QMap<QString,encodedString*> bodyCache; | ||
57 | }; | ||
58 | |||
59 | #endif | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index d3447f4..efd83ba 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -12,4 +12,5 @@ | |||
12 | 12 | ||
13 | POP3wrapper::POP3wrapper( POP3account *a ) | 13 | POP3wrapper::POP3wrapper( POP3account *a ) |
14 | : Genericwrapper() | ||
14 | { | 15 | { |
15 | account = a; | 16 | account = a; |
@@ -17,5 +18,4 @@ POP3wrapper::POP3wrapper( POP3account *a ) | |||
17 | msgTempName = a->getFileName()+"_msg_cache"; | 18 | msgTempName = a->getFileName()+"_msg_cache"; |
18 | last_msg_id = 0; | 19 | last_msg_id = 0; |
19 | bodyCache.clear(); | ||
20 | } | 20 | } |
21 | 21 | ||
@@ -27,16 +27,4 @@ POP3wrapper::~POP3wrapper() | |||
27 | msg_cache.remove(); | 27 | msg_cache.remove(); |
28 | } | 28 | } |
29 | cleanUpCache(); | ||
30 | } | ||
31 | |||
32 | void POP3wrapper::cleanUpCache() | ||
33 | { | ||
34 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | ||
35 | for (;it!=bodyCache.end();++it) { | ||
36 | encodedString*t = it.data(); | ||
37 | //it.setValue(0); | ||
38 | if (t) delete t; | ||
39 | } | ||
40 | bodyCache.clear(); | ||
41 | } | 29 | } |
42 | 30 | ||
@@ -51,5 +39,5 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
51 | char *message; | 39 | char *message; |
52 | size_t length = 0; | 40 | size_t length = 0; |
53 | 41 | ||
54 | login(); | 42 | login(); |
55 | if ( !m_pop3 ) { | 43 | if ( !m_pop3 ) { |
@@ -58,5 +46,6 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
58 | 46 | ||
59 | RecBody body; | 47 | RecBody body; |
60 | 48 | mailmessage * msg = 0; | |
49 | |||
61 | QFile msg_cache(msgTempName); | 50 | QFile msg_cache(msgTempName); |
62 | 51 | ||
@@ -65,5 +54,5 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
65 | return body; | 54 | return body; |
66 | } | 55 | } |
67 | cleanUpCache(); | 56 | cleanMimeCache(); |
68 | if (mail.getNumber()!=last_msg_id) { | 57 | if (mail.getNumber()!=last_msg_id) { |
69 | if (msg_cache.exists()) { | 58 | if (msg_cache.exists()) { |
@@ -93,46 +82,22 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
93 | memcpy(message,msg.latin1(),msg.length()); | 82 | memcpy(message,msg.latin1(),msg.length()); |
94 | } | 83 | } |
95 | body = parseMail(message); | ||
96 | free(message); | ||
97 | return body; | ||
98 | } | ||
99 | |||
100 | RecBody POP3wrapper::parseMail( char *message ) | ||
101 | { | ||
102 | int err = MAILIMF_NO_ERROR; | ||
103 | /* these vars are used recurcive! set it to 0!!!!!!!!!!!!!!!!! */ | ||
104 | size_t curTok = 0; | ||
105 | mailimf_message *result = 0; | ||
106 | mailmessage * msg=0; | ||
107 | mailmime_single_fields fields; | ||
108 | 84 | ||
109 | /* is bound to msg and will be freed there */ | 85 | /* transform to libetpan stuff */ |
110 | struct mailmime * mime=0; | ||
111 | |||
112 | RecBody body; | ||
113 | |||
114 | |||
115 | err = mailimf_message_parse( (char *) message, strlen( message ), &curTok, &result ); | ||
116 | if ( err != MAILIMF_NO_ERROR ) { | ||
117 | if (result) mailimf_message_free(result); | ||
118 | return body; | ||
119 | } | ||
120 | |||
121 | char*body_msg = message; | ||
122 | msg = mailmessage_new(); | 86 | msg = mailmessage_new(); |
123 | mailmessage_init(msg, NULL, data_message_driver, 0, strlen(body_msg)); | 87 | mailmessage_init(msg, NULL, data_message_driver, 0, strlen(message)); |
124 | generic_message_t * msg_data; | 88 | generic_message_t * msg_data; |
125 | msg_data = (generic_message_t *)msg->msg_data; | 89 | msg_data = (generic_message_t *)msg->msg_data; |
126 | msg_data->msg_fetched = 1; | 90 | msg_data->msg_fetched = 1; |
127 | msg_data->msg_message = body_msg; | 91 | msg_data->msg_message = message; |
128 | msg_data->msg_length = strlen(body_msg); | 92 | msg_data->msg_length = strlen(message); |
129 | 93 | ||
94 | /* parse the mail */ | ||
95 | body = parseMail(msg); | ||
130 | 96 | ||
131 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 97 | /* clean up */ |
132 | err = mailmessage_get_bodystructure(msg,&mime); | 98 | mailmessage_free(msg); |
133 | traverseBody(body,msg,mime); | 99 | free(message); |
134 | |||
135 | mailmessage_free(msg); | ||
136 | 100 | ||
101 | /* finish */ | ||
137 | return body; | 102 | return body; |
138 | } | 103 | } |
@@ -170,173 +135,4 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
170 | } | 135 | } |
171 | 136 | ||
172 | RecMail *POP3wrapper::parseHeader( const char *header ) | ||
173 | { | ||
174 | int err = MAILIMF_NO_ERROR; | ||
175 | size_t curTok = 0; | ||
176 | RecMail *mail = new RecMail(); | ||
177 | mailimf_fields *fields; | ||
178 | mailimf_references * refs; | ||
179 | mailimf_keywords*keys; | ||
180 | QString status; | ||
181 | QString value; | ||
182 | QBitArray mFlags(7); | ||
183 | |||
184 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); | ||
185 | for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) { | ||
186 | mailimf_field *field = (mailimf_field *) current->data; | ||
187 | switch ( field->fld_type ) { | ||
188 | case MAILIMF_FIELD_FROM: | ||
189 | mail->setFrom( parseMailboxList( field->fld_data.fld_from->frm_mb_list ) ); | ||
190 | break; | ||
191 | case MAILIMF_FIELD_TO: | ||
192 | mail->setTo( parseAddressList( field->fld_data.fld_to->to_addr_list ) ); | ||
193 | break; | ||
194 | case MAILIMF_FIELD_CC: | ||
195 | mail->setCC( parseAddressList( field->fld_data.fld_cc->cc_addr_list ) ); | ||
196 | break; | ||
197 | case MAILIMF_FIELD_BCC: | ||
198 | mail->setBcc( parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) ); | ||
199 | break; | ||
200 | case MAILIMF_FIELD_SUBJECT: | ||
201 | mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); | ||
202 | break; | ||
203 | case MAILIMF_FIELD_ORIG_DATE: | ||
204 | mail->setDate( parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) ); | ||
205 | break; | ||
206 | case MAILIMF_FIELD_MESSAGE_ID: | ||
207 | mail->setMsgid(QString(field->fld_data.fld_message_id->mid_value)); | ||
208 | break; | ||
209 | case MAILIMF_FIELD_REFERENCES: | ||
210 | refs = field->fld_data.fld_references; | ||
211 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
212 | char * text = (char*)refs->mid_list->first->data; | ||
213 | mail->setReplyto(QString(text)); | ||
214 | } | ||
215 | break; | ||
216 | case MAILIMF_FIELD_KEYWORDS: | ||
217 | keys = field->fld_data.fld_keywords; | ||
218 | for (clistcell*cur = clist_begin(keys->kw_list);cur!=0;cur=clist_next(cur)) { | ||
219 | qDebug("Keyword: %s",(char*)cur->data); | ||
220 | } | ||
221 | break; | ||
222 | case MAILIMF_FIELD_OPTIONAL_FIELD: | ||
223 | status = field->fld_data.fld_optional_field->fld_name; | ||
224 | value = field->fld_data.fld_optional_field->fld_value; | ||
225 | if (status.lower()=="status") { | ||
226 | if (value.lower()=="ro") { | ||
227 | mFlags.setBit(FLAG_SEEN); | ||
228 | } | ||
229 | } else if (status.lower()=="x-status") { | ||
230 | qDebug("X-Status: %s",value.latin1()); | ||
231 | if (value.lower()=="a") { | ||
232 | mFlags.setBit(FLAG_ANSWERED); | ||
233 | } | ||
234 | } else { | ||
235 | // qDebug("Optionales feld: %s -> %s)",field->fld_data.fld_optional_field->fld_name, | ||
236 | // field->fld_data.fld_optional_field->fld_value); | ||
237 | } | ||
238 | break; | ||
239 | default: | ||
240 | qDebug("Non parsed field"); | ||
241 | break; | ||
242 | } | ||
243 | } | ||
244 | if (fields) mailimf_fields_free(fields); | ||
245 | mail->setFlags(mFlags); | ||
246 | return mail; | ||
247 | } | ||
248 | |||
249 | QString POP3wrapper::parseDateTime( mailimf_date_time *date ) | ||
250 | { | ||
251 | char tmp[23]; | ||
252 | |||
253 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | ||
254 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | ||
255 | |||
256 | return QString( tmp ); | ||
257 | } | ||
258 | |||
259 | QString POP3wrapper::parseAddressList( mailimf_address_list *list ) | ||
260 | { | ||
261 | QString result( "" ); | ||
262 | |||
263 | bool first = true; | ||
264 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | ||
265 | mailimf_address *addr = (mailimf_address *) current->data; | ||
266 | |||
267 | if ( !first ) { | ||
268 | result.append( "," ); | ||
269 | } else { | ||
270 | first = false; | ||
271 | } | ||
272 | |||
273 | switch ( addr->ad_type ) { | ||
274 | case MAILIMF_ADDRESS_MAILBOX: | ||
275 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | ||
276 | break; | ||
277 | case MAILIMF_ADDRESS_GROUP: | ||
278 | result.append( parseGroup( addr->ad_data.ad_group ) ); | ||
279 | break; | ||
280 | default: | ||
281 | qDebug( "POP3: unkown mailimf address type" ); | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | return result; | ||
287 | } | ||
288 | |||
289 | QString POP3wrapper::parseGroup( mailimf_group *group ) | ||
290 | { | ||
291 | QString result( "" ); | ||
292 | |||
293 | result.append( group->grp_display_name ); | ||
294 | result.append( ": " ); | ||
295 | |||
296 | if ( group->grp_mb_list != NULL ) { | ||
297 | result.append( parseMailboxList( group->grp_mb_list ) ); | ||
298 | } | ||
299 | |||
300 | result.append( ";" ); | ||
301 | |||
302 | return result; | ||
303 | } | ||
304 | |||
305 | QString POP3wrapper::parseMailbox( mailimf_mailbox *box ) | ||
306 | { | ||
307 | QString result( "" ); | ||
308 | |||
309 | if ( box->mb_display_name == NULL ) { | ||
310 | result.append( box->mb_addr_spec ); | ||
311 | } else { | ||
312 | result.append( convert_String(box->mb_display_name).latin1() ); | ||
313 | result.append( " <" ); | ||
314 | result.append( box->mb_addr_spec ); | ||
315 | result.append( ">" ); | ||
316 | } | ||
317 | |||
318 | return result; | ||
319 | } | ||
320 | |||
321 | QString POP3wrapper::parseMailboxList( mailimf_mailbox_list *list ) | ||
322 | { | ||
323 | QString result( "" ); | ||
324 | |||
325 | bool first = true; | ||
326 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | ||
327 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | ||
328 | |||
329 | if ( !first ) { | ||
330 | result.append( "," ); | ||
331 | } else { | ||
332 | first = false; | ||
333 | } | ||
334 | |||
335 | result.append( parseMailbox( box ) ); | ||
336 | } | ||
337 | |||
338 | return result; | ||
339 | } | ||
340 | |||
341 | void POP3wrapper::login() | 137 | void POP3wrapper::login() |
342 | { | 138 | { |
@@ -420,12 +216,4 @@ QList<Folder>* POP3wrapper::listFolders() | |||
420 | } | 216 | } |
421 | 217 | ||
422 | QString POP3wrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | ||
423 | { | ||
424 | encodedString*t = fetchDecodedPart(mail,part); | ||
425 | QString text=t->Content(); | ||
426 | delete t; | ||
427 | return text; | ||
428 | } | ||
429 | |||
430 | void POP3wrapper::deleteMail(const RecMail&mail) | 218 | void POP3wrapper::deleteMail(const RecMail&mail) |
431 | { | 219 | { |
@@ -441,178 +229,2 @@ void POP3wrapper::answeredMail(const RecMail&) | |||
441 | { | 229 | { |
442 | } | 230 | } |
443 | |||
444 | encodedString* POP3wrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | ||
445 | { | ||
446 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | ||
447 | if (it==bodyCache.end()) return new encodedString(); | ||
448 | encodedString*t = decode_String(it.data(),part.Encoding()); | ||
449 | return t; | ||
450 | } | ||
451 | |||
452 | encodedString* POP3wrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | ||
453 | { | ||
454 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | ||
455 | if (it==bodyCache.end()) return new encodedString(); | ||
456 | encodedString*t = it.data(); | ||
457 | return t; | ||
458 | } | ||
459 | |||
460 | void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) | ||
461 | { | ||
462 | if (current_rec >= 10) { | ||
463 | qDebug("too deep recursion!"); | ||
464 | } | ||
465 | if (!message || !mime) { | ||
466 | return; | ||
467 | } | ||
468 | int r; | ||
469 | char*data = 0; | ||
470 | size_t len; | ||
471 | clistiter * cur = 0; | ||
472 | int res; | ||
473 | QString b; | ||
474 | RecPart part; | ||
475 | |||
476 | switch (mime->mm_type) { | ||
477 | case MAILMIME_SINGLE: | ||
478 | r = mailmessage_fetch_section(message,mime,&data,&len); | ||
479 | part.setSize(len); | ||
480 | fillSingleBody(part,message,mime); | ||
481 | if (part.Type()=="text" && target.Bodytext().isNull()) { | ||
482 | encodedString*r = new encodedString(); | ||
483 | r->setContent(data,len); | ||
484 | encodedString*res = decode_String(r,part.Encoding()); | ||
485 | b = QString(res->Content()); | ||
486 | delete r; | ||
487 | delete res; | ||
488 | target.setBodytext(b); | ||
489 | target.setDescription(part); | ||
490 | } else { | ||
491 | b = gen_attachment_id(); | ||
492 | part.setIdentifier(b); | ||
493 | bodyCache[b]=new encodedString(data,len); | ||
494 | target.addPart(part); | ||
495 | } | ||
496 | break; | ||
497 | case MAILMIME_MULTIPLE: | ||
498 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | ||
499 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); | ||
500 | } | ||
501 | break; | ||
502 | case MAILMIME_MESSAGE: | ||
503 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | ||
504 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); | ||
505 | } | ||
506 | break; | ||
507 | } | ||
508 | } | ||
509 | |||
510 | QString POP3wrapper::getencoding(mailmime_mechanism*aEnc) | ||
511 | { | ||
512 | QString enc="7bit"; | ||
513 | if (!aEnc) return enc; | ||
514 | switch(aEnc->enc_type) { | ||
515 | case MAILMIME_MECHANISM_7BIT: | ||
516 | enc = "7bit"; | ||
517 | break; | ||
518 | case MAILMIME_MECHANISM_8BIT: | ||
519 | enc = "8bit"; | ||
520 | break; | ||
521 | case MAILMIME_MECHANISM_BINARY: | ||
522 | enc = "binary"; | ||
523 | break; | ||
524 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: | ||
525 | enc = "quoted-printable"; | ||
526 | break; | ||
527 | case MAILMIME_MECHANISM_BASE64: | ||
528 | enc = "base64"; | ||
529 | break; | ||
530 | case MAILMIME_MECHANISM_TOKEN: | ||
531 | default: | ||
532 | if (aEnc->enc_token) { | ||
533 | enc = QString(aEnc->enc_token); | ||
534 | } | ||
535 | break; | ||
536 | } | ||
537 | return enc; | ||
538 | } | ||
539 | |||
540 | void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | ||
541 | { | ||
542 | if (!mime) { | ||
543 | return; | ||
544 | } | ||
545 | mailmime_field*field = 0; | ||
546 | mailmime_single_fields fields; | ||
547 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
548 | if (mime->mm_mime_fields != NULL) { | ||
549 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
550 | mime->mm_content_type); | ||
551 | } | ||
552 | |||
553 | mailmime_content*type = fields.fld_content; | ||
554 | clistcell*current; | ||
555 | if (!type) { | ||
556 | target.setType("text"); | ||
557 | target.setSubtype("plain"); | ||
558 | } else { | ||
559 | target.setSubtype(type->ct_subtype); | ||
560 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | ||
561 | case MAILMIME_DISCRETE_TYPE_TEXT: | ||
562 | target.setType("text"); | ||
563 | break; | ||
564 | case MAILMIME_DISCRETE_TYPE_IMAGE: | ||
565 | target.setType("image"); | ||
566 | break; | ||
567 | case MAILMIME_DISCRETE_TYPE_AUDIO: | ||
568 | target.setType("audio"); | ||
569 | break; | ||
570 | case MAILMIME_DISCRETE_TYPE_VIDEO: | ||
571 | target.setType("video"); | ||
572 | break; | ||
573 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | ||
574 | target.setType("application"); | ||
575 | break; | ||
576 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | ||
577 | default: | ||
578 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { | ||
579 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); | ||
580 | } | ||
581 | break; | ||
582 | } | ||
583 | if (type->ct_parameters) { | ||
584 | fillParameters(target,type->ct_parameters); | ||
585 | } | ||
586 | } | ||
587 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { | ||
588 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { | ||
589 | field = (mailmime_field*)current->data; | ||
590 | switch(field->fld_type) { | ||
591 | case MAILMIME_FIELD_TRANSFER_ENCODING: | ||
592 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); | ||
593 | break; | ||
594 | case MAILMIME_FIELD_ID: | ||
595 | target.setIdentifier(field->fld_data.fld_id); | ||
596 | break; | ||
597 | case MAILMIME_FIELD_DESCRIPTION: | ||
598 | target.setDescription(field->fld_data.fld_description); | ||
599 | break; | ||
600 | default: | ||
601 | break; | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | } | ||
606 | |||
607 | void POP3wrapper::fillParameters(RecPart&target,clist*parameters) | ||
608 | { | ||
609 | if (!parameters) {return;} | ||
610 | clistcell*current=0; | ||
611 | mailmime_parameter*param; | ||
612 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { | ||
613 | param = (mailmime_parameter*)current->data; | ||
614 | if (param) { | ||
615 | target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
616 | } | ||
617 | } | ||
618 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 75d70f8..b738cca 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -2,24 +2,10 @@ | |||
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
4 | #include <libetpan/clist.h> | ||
5 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
6 | #include "abstractmail.h" | 5 | #include "genericwrapper.h" |
7 | #include <qmap.h> | ||
8 | #include <qstring.h> | 6 | #include <qstring.h> |
9 | 7 | ||
10 | class RecMail; | ||
11 | class RecBody; | ||
12 | class encodedString; | ||
13 | struct mailpop3; | ||
14 | struct mailmessage; | ||
15 | struct mailmime; | ||
16 | struct mailmime_mechanism; | ||
17 | struct mailimf_mailbox_list; | ||
18 | struct mailimf_mailbox; | ||
19 | struct mailimf_date_time; | ||
20 | struct mailimf_group; | ||
21 | struct mailimf_address_list; | ||
22 | 8 | ||
23 | class POP3wrapper : public AbstractMail | 9 | class POP3wrapper : public Genericwrapper |
24 | { | 10 | { |
25 | Q_OBJECT | 11 | Q_OBJECT |
@@ -31,12 +17,9 @@ public: | |||
31 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 17 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
32 | virtual QList<Folder>* listFolders(); | 18 | virtual QList<Folder>* listFolders(); |
33 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | ||
34 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | ||
35 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | ||
36 | 19 | ||
37 | virtual void deleteMail(const RecMail&mail); | 20 | virtual void deleteMail(const RecMail&mail); |
38 | virtual void answeredMail(const RecMail&mail); | 21 | virtual void answeredMail(const RecMail&mail); |
39 | 22 | ||
40 | RecBody fetchBody( const RecMail &mail ); | 23 | virtual RecBody fetchBody( const RecMail &mail ); |
41 | static void pop3_progress( size_t current, size_t maximum ); | 24 | static void pop3_progress( size_t current, size_t maximum ); |
42 | 25 | ||
@@ -45,24 +28,4 @@ protected: | |||
45 | void logout(); | 28 | void logout(); |
46 | 29 | ||
47 | RecMail *parseHeader( const char *header ); | ||
48 | RecBody parseMail( char *message ); | ||
49 | QString parseMailboxList( mailimf_mailbox_list *list ); | ||
50 | QString parseMailbox( mailimf_mailbox *box ); | ||
51 | QString parseGroup( mailimf_group *group ); | ||
52 | QString parseAddressList( mailimf_address_list *list ); | ||
53 | QString parseDateTime( mailimf_date_time *date ); | ||
54 | |||
55 | void cleanUpCache(); | ||
56 | |||
57 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); | ||
58 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | ||
59 | static void fillParameters(RecPart&target,clist*parameters); | ||
60 | static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); | ||
61 | |||
62 | POP3account *account; | ||
63 | mailpop3 *m_pop3; | ||
64 | QString msgTempName; | ||
65 | unsigned int last_msg_id; | ||
66 | QMap<QString,encodedString*> bodyCache; | ||
67 | }; | 30 | }; |
68 | 31 | ||