author | alwin <alwin> | 2004-03-08 03:04:35 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 03:04:35 (UTC) |
commit | 25d95c1b4e61445c695177c79049ccf7741e83f7 (patch) (unidiff) | |
tree | 9f90bf01e587fcd6a9bf0b2c52da7ae98f4871f0 | |
parent | 9553bf83fd98812781b5d15aad9b69daaadec3f5 (diff) | |
download | opie-25d95c1b4e61445c695177c79049ccf7741e83f7.zip opie-25d95c1b4e61445c695177c79049ccf7741e83f7.tar.gz opie-25d95c1b4e61445c695177c79049ccf7741e83f7.tar.bz2 |
obsolete methode removed
store msgids when parsing a mail-header
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 85 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 1 |
2 files changed, 5 insertions, 81 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 3fe319b..eb2c031 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -177,205 +177,128 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
177 | } | 177 | } |
178 | } | 178 | } |
179 | break; | 179 | break; |
180 | case MAILMIME_MULTIPLE: | 180 | case MAILMIME_MULTIPLE: |
181 | { | 181 | { |
182 | unsigned int ccount = 1; | 182 | unsigned int ccount = 1; |
183 | mailmime*cbody=0; | 183 | mailmime*cbody=0; |
184 | QValueList<int>countlist = recList; | 184 | QValueList<int>countlist = recList; |
185 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 185 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
186 | cbody = (mailmime*)clist_content(cur); | 186 | cbody = (mailmime*)clist_content(cur); |
187 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 187 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
188 | RecPart targetPart; | 188 | RecPart targetPart; |
189 | targetPart.setType("multipart"); | 189 | targetPart.setType("multipart"); |
190 | countlist.append(current_count); | 190 | countlist.append(current_count); |
191 | targetPart.setPositionlist(countlist); | 191 | targetPart.setPositionlist(countlist); |
192 | target.addPart(targetPart); | 192 | target.addPart(targetPart); |
193 | } | 193 | } |
194 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); | 194 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); |
195 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 195 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
196 | countlist = recList; | 196 | countlist = recList; |
197 | } | 197 | } |
198 | ++ccount; | 198 | ++ccount; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | break; | 201 | break; |
202 | case MAILMIME_MESSAGE: | 202 | case MAILMIME_MESSAGE: |
203 | { | 203 | { |
204 | QValueList<int>countlist = recList; | 204 | QValueList<int>countlist = recList; |
205 | countlist.append(current_count); | 205 | countlist.append(current_count); |
206 | /* the own header is always at recursion 0 - we don't need that */ | 206 | /* the own header is always at recursion 0 - we don't need that */ |
207 | if (current_rec > 0) { | 207 | if (current_rec > 0) { |
208 | part.setPositionlist(countlist); | 208 | part.setPositionlist(countlist); |
209 | r = mailmessage_fetch_section(message,mime,&data,&len); | 209 | r = mailmessage_fetch_section(message,mime,&data,&len); |
210 | part.setSize(len); | 210 | part.setSize(len); |
211 | part.setPositionlist(countlist); | 211 | part.setPositionlist(countlist); |
212 | b = gen_attachment_id(); | 212 | b = gen_attachment_id(); |
213 | part.setIdentifier(b); | 213 | part.setIdentifier(b); |
214 | part.setType("message"); | 214 | part.setType("message"); |
215 | part.setSubtype("rfc822"); | 215 | part.setSubtype("rfc822"); |
216 | bodyCache[b]=new encodedString(data,len); | 216 | bodyCache[b]=new encodedString(data,len); |
217 | target.addPart(part); | 217 | target.addPart(part); |
218 | } | 218 | } |
219 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 219 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
220 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 220 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | RecBody Genericwrapper::parseMail( mailmessage * msg ) | 227 | RecBody Genericwrapper::parseMail( mailmessage * msg ) |
228 | { | 228 | { |
229 | int err = MAILIMF_NO_ERROR; | 229 | int err = MAILIMF_NO_ERROR; |
230 | mailmime_single_fields fields; | 230 | mailmime_single_fields fields; |
231 | /* is bound to msg and will be freed there */ | 231 | /* is bound to msg and will be freed there */ |
232 | mailmime * mime=0; | 232 | mailmime * mime=0; |
233 | RecBody body; | 233 | RecBody body; |
234 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 234 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
235 | err = mailmessage_get_bodystructure(msg,&mime); | 235 | err = mailmessage_get_bodystructure(msg,&mime); |
236 | QValueList<int>recList; | 236 | QValueList<int>recList; |
237 | traverseBody(body,msg,mime,recList); | 237 | traverseBody(body,msg,mime,recList); |
238 | return body; | 238 | return body; |
239 | } | 239 | } |
240 | 240 | ||
241 | RecMail *Genericwrapper::parseHeader( const char *header ) | ||
242 | { | ||
243 | int err = MAILIMF_NO_ERROR; | ||
244 | size_t curTok = 0; | ||
245 | RecMail *mail = new RecMail(); | ||
246 | mailimf_fields *fields = 0; | ||
247 | mailimf_references * refs = 0; | ||
248 | mailimf_keywords*keys = 0; | ||
249 | QString status; | ||
250 | QString value; | ||
251 | QBitArray mFlags(7); | ||
252 | |||
253 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); | ||
254 | for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) { | ||
255 | mailimf_field *field = (mailimf_field *) current->data; | ||
256 | switch ( field->fld_type ) { | ||
257 | case MAILIMF_FIELD_FROM: | ||
258 | mail->setFrom( parseMailboxList( field->fld_data.fld_from->frm_mb_list ) ); | ||
259 | break; | ||
260 | case MAILIMF_FIELD_TO: | ||
261 | mail->setTo( parseAddressList( field->fld_data.fld_to->to_addr_list ) ); | ||
262 | break; | ||
263 | case MAILIMF_FIELD_CC: | ||
264 | mail->setCC( parseAddressList( field->fld_data.fld_cc->cc_addr_list ) ); | ||
265 | break; | ||
266 | case MAILIMF_FIELD_BCC: | ||
267 | mail->setBcc( parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) ); | ||
268 | break; | ||
269 | case MAILIMF_FIELD_SUBJECT: | ||
270 | mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); | ||
271 | break; | ||
272 | case MAILIMF_FIELD_ORIG_DATE: | ||
273 | mail->setDate( parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) ); | ||
274 | break; | ||
275 | case MAILIMF_FIELD_MESSAGE_ID: | ||
276 | mail->setMsgid(QString(field->fld_data.fld_message_id->mid_value)); | ||
277 | break; | ||
278 | case MAILIMF_FIELD_REFERENCES: | ||
279 | refs = field->fld_data.fld_references; | ||
280 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
281 | char * text = (char*)refs->mid_list->first->data; | ||
282 | mail->setReplyto(QString(text)); | ||
283 | } | ||
284 | break; | ||
285 | case MAILIMF_FIELD_KEYWORDS: | ||
286 | keys = field->fld_data.fld_keywords; | ||
287 | for (clistcell*cur = clist_begin(keys->kw_list);cur!=0;cur=clist_next(cur)) { | ||
288 | qDebug("Keyword: %s",(char*)cur->data); | ||
289 | } | ||
290 | break; | ||
291 | case MAILIMF_FIELD_OPTIONAL_FIELD: | ||
292 | status = field->fld_data.fld_optional_field->fld_name; | ||
293 | value = field->fld_data.fld_optional_field->fld_value; | ||
294 | if (status.lower()=="status") { | ||
295 | if (value.lower()=="ro") { | ||
296 | mFlags.setBit(FLAG_SEEN); | ||
297 | } | ||
298 | } else if (status.lower()=="x-status") { | ||
299 | qDebug("X-Status: %s",value.latin1()); | ||
300 | if (value.lower()=="a") { | ||
301 | mFlags.setBit(FLAG_ANSWERED); | ||
302 | } | ||
303 | } else { | ||
304 | // qDebug("Optionales feld: %s -> %s)",field->fld_data.fld_optional_field->fld_name, | ||
305 | // field->fld_data.fld_optional_field->fld_value); | ||
306 | } | ||
307 | break; | ||
308 | default: | ||
309 | qDebug("Non parsed field"); | ||
310 | break; | ||
311 | } | ||
312 | } | ||
313 | if (fields) mailimf_fields_free(fields); | ||
314 | mail->setFlags(mFlags); | ||
315 | return mail; | ||
316 | } | ||
317 | |||
318 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | 241 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) |
319 | { | 242 | { |
320 | char tmp[23]; | 243 | char tmp[23]; |
321 | 244 | ||
322 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | 245 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", |
323 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 246 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
324 | 247 | ||
325 | return QString( tmp ); | 248 | return QString( tmp ); |
326 | } | 249 | } |
327 | 250 | ||
328 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | 251 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) |
329 | { | 252 | { |
330 | QString result( "" ); | 253 | QString result( "" ); |
331 | 254 | ||
332 | bool first = true; | 255 | bool first = true; |
333 | if (list == 0) return result; | 256 | if (list == 0) return result; |
334 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | 257 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
335 | mailimf_address *addr = (mailimf_address *) current->data; | 258 | mailimf_address *addr = (mailimf_address *) current->data; |
336 | 259 | ||
337 | if ( !first ) { | 260 | if ( !first ) { |
338 | result.append( "," ); | 261 | result.append( "," ); |
339 | } else { | 262 | } else { |
340 | first = false; | 263 | first = false; |
341 | } | 264 | } |
342 | 265 | ||
343 | switch ( addr->ad_type ) { | 266 | switch ( addr->ad_type ) { |
344 | case MAILIMF_ADDRESS_MAILBOX: | 267 | case MAILIMF_ADDRESS_MAILBOX: |
345 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | 268 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); |
346 | break; | 269 | break; |
347 | case MAILIMF_ADDRESS_GROUP: | 270 | case MAILIMF_ADDRESS_GROUP: |
348 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 271 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
349 | break; | 272 | break; |
350 | default: | 273 | default: |
351 | qDebug( "Generic: unkown mailimf address type" ); | 274 | qDebug( "Generic: unkown mailimf address type" ); |
352 | break; | 275 | break; |
353 | } | 276 | } |
354 | } | 277 | } |
355 | 278 | ||
356 | return result; | 279 | return result; |
357 | } | 280 | } |
358 | 281 | ||
359 | QString Genericwrapper::parseGroup( mailimf_group *group ) | 282 | QString Genericwrapper::parseGroup( mailimf_group *group ) |
360 | { | 283 | { |
361 | QString result( "" ); | 284 | QString result( "" ); |
362 | 285 | ||
363 | result.append( group->grp_display_name ); | 286 | result.append( group->grp_display_name ); |
364 | result.append( ": " ); | 287 | result.append( ": " ); |
365 | 288 | ||
366 | if ( group->grp_mb_list != NULL ) { | 289 | if ( group->grp_mb_list != NULL ) { |
367 | result.append( parseMailboxList( group->grp_mb_list ) ); | 290 | result.append( parseMailboxList( group->grp_mb_list ) ); |
368 | } | 291 | } |
369 | 292 | ||
370 | result.append( ";" ); | 293 | result.append( ";" ); |
371 | 294 | ||
372 | return result; | 295 | return result; |
373 | } | 296 | } |
374 | 297 | ||
375 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | 298 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) |
376 | { | 299 | { |
377 | QString result( "" ); | 300 | QString result( "" ); |
378 | 301 | ||
379 | if ( box->mb_display_name == NULL ) { | 302 | if ( box->mb_display_name == NULL ) { |
380 | result.append( box->mb_addr_spec ); | 303 | result.append( box->mb_addr_spec ); |
381 | } else { | 304 | } else { |
@@ -439,78 +362,80 @@ void Genericwrapper::cleanMimeCache() | |||
439 | encodedString*t = it.data(); | 362 | encodedString*t = it.data(); |
440 | //it.setValue(0); | 363 | //it.setValue(0); |
441 | if (t) delete t; | 364 | if (t) delete t; |
442 | } | 365 | } |
443 | bodyCache.clear(); | 366 | bodyCache.clear(); |
444 | qDebug("Genericwrapper: cache cleaned"); | 367 | qDebug("Genericwrapper: cache cleaned"); |
445 | } | 368 | } |
446 | 369 | ||
447 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 370 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
448 | { | 371 | { |
449 | int r; | 372 | int r; |
450 | mailmessage_list * env_list = 0; | 373 | mailmessage_list * env_list = 0; |
451 | r = mailsession_get_messages_list(session,&env_list); | 374 | r = mailsession_get_messages_list(session,&env_list); |
452 | if (r != MAIL_NO_ERROR) { | 375 | if (r != MAIL_NO_ERROR) { |
453 | qDebug("Error message list"); | 376 | qDebug("Error message list"); |
454 | return; | 377 | return; |
455 | } | 378 | } |
456 | r = mailsession_get_envelopes_list(session, env_list); | 379 | r = mailsession_get_envelopes_list(session, env_list); |
457 | if (r != MAIL_NO_ERROR) { | 380 | if (r != MAIL_NO_ERROR) { |
458 | qDebug("Error filling message list"); | 381 | qDebug("Error filling message list"); |
459 | if (env_list) { | 382 | if (env_list) { |
460 | mailmessage_list_free(env_list); | 383 | mailmessage_list_free(env_list); |
461 | } | 384 | } |
462 | return; | 385 | return; |
463 | } | 386 | } |
464 | mailimf_references * refs; | 387 | mailimf_references * refs; |
465 | uint32_t i = 0; | 388 | uint32_t i = 0; |
466 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 389 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
467 | mailmessage * msg; | 390 | mailmessage * msg; |
468 | QBitArray mFlags(7); | 391 | QBitArray mFlags(7); |
469 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 392 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
470 | if (msg->msg_fields == NULL) { | 393 | if (msg->msg_fields == NULL) { |
471 | //qDebug("could not fetch envelope of message %i", i); | 394 | //qDebug("could not fetch envelope of message %i", i); |
472 | continue; | 395 | continue; |
473 | } | 396 | } |
474 | RecMail * mail = new RecMail(); | 397 | RecMail * mail = new RecMail(); |
475 | mail->setWrapper(this); | 398 | mail->setWrapper(this); |
476 | mail_flags * flag_result = 0; | 399 | mail_flags * flag_result = 0; |
477 | r = mailmessage_get_flags(msg,&flag_result); | 400 | r = mailmessage_get_flags(msg,&flag_result); |
478 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 401 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
479 | mFlags.setBit(FLAG_SEEN); | 402 | mFlags.setBit(FLAG_SEEN); |
480 | } | 403 | } |
481 | mailimf_single_fields single_fields; | 404 | mailimf_single_fields single_fields; |
482 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 405 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
483 | mail->setMsgsize(msg->msg_size); | 406 | mail->setMsgsize(msg->msg_size); |
484 | mail->setFlags(mFlags); | 407 | mail->setFlags(mFlags); |
485 | mail->setMbox(mailbox); | 408 | mail->setMbox(mailbox); |
486 | mail->setNumber(msg->msg_index); | 409 | mail->setNumber(msg->msg_index); |
487 | if (single_fields.fld_subject) | 410 | if (single_fields.fld_subject) |
488 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 411 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
489 | if (single_fields.fld_from) | 412 | if (single_fields.fld_from) |
490 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 413 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
491 | if (!mbox_as_to) { | 414 | if (!mbox_as_to) { |
492 | if (single_fields.fld_to) | 415 | if (single_fields.fld_to) |
493 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 416 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
494 | } else { | 417 | } else { |
495 | mail->setTo(mailbox); | 418 | mail->setTo(mailbox); |
496 | } | 419 | } |
497 | if (single_fields.fld_cc) | 420 | if (single_fields.fld_cc) |
498 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 421 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
499 | if (single_fields.fld_bcc) | 422 | if (single_fields.fld_bcc) |
500 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 423 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
501 | if (single_fields.fld_orig_date) | 424 | if (single_fields.fld_orig_date) |
502 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 425 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
503 | // crashes when accessing pop3 account | 426 | // crashes when accessing pop3 account? |
504 | // if (single_fields.fld_message_id->mid_value) | 427 | if (single_fields.fld_message_id->mid_value) { |
505 | // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 428 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
429 | qDebug("Msqgid == %s",mail->Msgid().latin1()); | ||
430 | } | ||
506 | refs = single_fields.fld_references; | 431 | refs = single_fields.fld_references; |
507 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 432 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
508 | char * text = (char*)refs->mid_list->first->data; | 433 | char * text = (char*)refs->mid_list->first->data; |
509 | mail->setReplyto(QString(text)); | 434 | mail->setReplyto(QString(text)); |
510 | } | 435 | } |
511 | target.append(mail); | 436 | target.append(mail); |
512 | } | 437 | } |
513 | if (env_list) { | 438 | if (env_list) { |
514 | mailmessage_list_free(env_list); | 439 | mailmessage_list_free(env_list); |
515 | } | 440 | } |
516 | } | 441 | } |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index b451416..0870912 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -1,66 +1,65 @@ | |||
1 | #ifndef __GENERIC_WRAPPER_H | 1 | #ifndef __GENERIC_WRAPPER_H |
2 | #define __GENERIC_WRAPPER_H | 2 | #define __GENERIC_WRAPPER_H |
3 | 3 | ||
4 | #include "abstractmail.h" | 4 | #include "abstractmail.h" |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <libetpan/clist.h> | 7 | #include <libetpan/clist.h> |
8 | 8 | ||
9 | class RecMail; | 9 | class RecMail; |
10 | class RecBody; | 10 | class RecBody; |
11 | class encodedString; | 11 | class encodedString; |
12 | struct mailpop3; | 12 | struct mailpop3; |
13 | struct mailmessage; | 13 | struct mailmessage; |
14 | struct mailmime; | 14 | struct mailmime; |
15 | struct mailmime_mechanism; | 15 | struct mailmime_mechanism; |
16 | struct mailimf_mailbox_list; | 16 | struct mailimf_mailbox_list; |
17 | struct mailimf_mailbox; | 17 | struct mailimf_mailbox; |
18 | struct mailimf_date_time; | 18 | struct mailimf_date_time; |
19 | struct mailimf_group; | 19 | struct mailimf_group; |
20 | struct mailimf_address_list; | 20 | struct mailimf_address_list; |
21 | struct mailsession; | 21 | struct mailsession; |
22 | struct mailstorage; | 22 | struct mailstorage; |
23 | struct mailfolder; | 23 | struct mailfolder; |
24 | 24 | ||
25 | /* this class hold just the funs shared between | 25 | /* this class hold just the funs shared between |
26 | * mbox and pop3 (later mh, too) mail access. | 26 | * mbox and pop3 (later mh, too) mail access. |
27 | * it is not desigend to make a instance of it! | 27 | * it is not desigend to make a instance of it! |
28 | */ | 28 | */ |
29 | class Genericwrapper : public AbstractMail | 29 | class Genericwrapper : public AbstractMail |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | public: | 32 | public: |
33 | Genericwrapper(); | 33 | Genericwrapper(); |
34 | virtual ~Genericwrapper(); | 34 | virtual ~Genericwrapper(); |
35 | 35 | ||
36 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 36 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
37 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 37 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
38 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 38 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
39 | virtual void cleanMimeCache(); | 39 | virtual void cleanMimeCache(); |
40 | virtual int deleteMbox(const Folder*){return 1;} | 40 | virtual int deleteMbox(const Folder*){return 1;} |
41 | virtual void logout(){}; | 41 | virtual void logout(){}; |
42 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | 42 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; |
43 | 43 | ||
44 | protected: | 44 | protected: |
45 | RecMail *parseHeader( const char *header ); | ||
46 | RecBody parseMail( mailmessage * msg ); | 45 | RecBody parseMail( mailmessage * msg ); |
47 | QString parseMailboxList( mailimf_mailbox_list *list ); | 46 | QString parseMailboxList( mailimf_mailbox_list *list ); |
48 | QString parseMailbox( mailimf_mailbox *box ); | 47 | QString parseMailbox( mailimf_mailbox *box ); |
49 | QString parseGroup( mailimf_group *group ); | 48 | QString parseGroup( mailimf_group *group ); |
50 | QString parseAddressList( mailimf_address_list *list ); | 49 | QString parseAddressList( mailimf_address_list *list ); |
51 | QString parseDateTime( mailimf_date_time *date ); | 50 | QString parseDateTime( mailimf_date_time *date ); |
52 | 51 | ||
53 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 52 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
54 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 53 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
55 | static void fillParameters(RecPart&target,clist*parameters); | 54 | static void fillParameters(RecPart&target,clist*parameters); |
56 | static QString getencoding(mailmime_mechanism*aEnc); | 55 | static QString getencoding(mailmime_mechanism*aEnc); |
57 | virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); | 56 | virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); |
58 | 57 | ||
59 | QString msgTempName; | 58 | QString msgTempName; |
60 | unsigned int last_msg_id; | 59 | unsigned int last_msg_id; |
61 | QMap<QString,encodedString*> bodyCache; | 60 | QMap<QString,encodedString*> bodyCache; |
62 | mailstorage * m_storage; | 61 | mailstorage * m_storage; |
63 | mailfolder*m_folder; | 62 | mailfolder*m_folder; |
64 | }; | 63 | }; |
65 | 64 | ||
66 | #endif | 65 | #endif |