author | alwin <alwin> | 2003-12-13 02:36:57 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-13 02:36:57 (UTC) |
commit | a170120c655169de904ff282e23461ba4eef2b47 (patch) (unidiff) | |
tree | 0c7f7612fbe9610cf4bc23a5b9aba5f5591d7caf | |
parent | f689ef512cfc0a56fead4839a6b2e24a6ee282e0 (diff) | |
download | opie-a170120c655169de904ff282e23461ba4eef2b47.zip opie-a170120c655169de904ff282e23461ba4eef2b47.tar.gz opie-a170120c655169de904ff282e23461ba4eef2b47.tar.bz2 |
mails will marked as read now
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 7b75ffa..3941cec 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -310,50 +310,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
310 | m->setFlags(mFlags); | 310 | m->setFlags(mFlags); |
311 | m->setMsgsize(size); | 311 | m->setMsgsize(size); |
312 | } | 312 | } |
313 | return m; | 313 | return m; |
314 | } | 314 | } |
315 | 315 | ||
316 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) | 316 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) |
317 | { | 317 | { |
318 | RecBody body; | 318 | RecBody body; |
319 | const char *mb; | 319 | const char *mb; |
320 | int err = MAILIMAP_NO_ERROR; | 320 | int err = MAILIMAP_NO_ERROR; |
321 | clist *result; | 321 | clist *result; |
322 | clistcell *current; | 322 | clistcell *current; |
323 | mailimap_fetch_att *fetchAtt; | 323 | mailimap_fetch_att *fetchAtt; |
324 | mailimap_fetch_type *fetchType; | 324 | mailimap_fetch_type *fetchType; |
325 | mailimap_set *set; | 325 | mailimap_set *set; |
326 | mailimap_body*body_desc; | 326 | mailimap_body*body_desc; |
327 | 327 | ||
328 | mb = mail.getMbox().latin1(); | 328 | mb = mail.getMbox().latin1(); |
329 | 329 | ||
330 | login(); | 330 | login(); |
331 | if (!m_imap) { | 331 | if (!m_imap) { |
332 | return body; | 332 | return body; |
333 | } | 333 | } |
334 | /* select mailbox READONLY for operations */ | 334 | |
335 | err = mailimap_examine( m_imap, (char*)mb); | 335 | err = mailimap_select( m_imap, (char*)mb); |
336 | if ( err != MAILIMAP_NO_ERROR ) { | 336 | if ( err != MAILIMAP_NO_ERROR ) { |
337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
338 | return body; | 338 | return body; |
339 | } | 339 | } |
340 | 340 | ||
341 | result = clist_new(); | 341 | result = clist_new(); |
342 | /* the range has to start at 1!!! not with 0!!!! */ | 342 | /* the range has to start at 1!!! not with 0!!!! */ |
343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
346 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 346 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
347 | mailimap_set_free( set ); | 347 | mailimap_set_free( set ); |
348 | mailimap_fetch_type_free( fetchType ); | 348 | mailimap_fetch_type_free( fetchType ); |
349 | 349 | ||
350 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 350 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
351 | mailimap_msg_att * msg_att; | 351 | mailimap_msg_att * msg_att; |
352 | msg_att = (mailimap_msg_att*)current->data; | 352 | msg_att = (mailimap_msg_att*)current->data; |
353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
354 | body_desc = item->att_data.att_static->att_data.att_body; | 354 | body_desc = item->att_data.att_static->att_data.att_body; |
355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { | 355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { |
356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | 358 | qDebug("Mulitpart mail"); |
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); | 359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); |
@@ -438,50 +438,49 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
438 | } | 438 | } |
439 | l.append(QString(from)); | 439 | l.append(QString(from)); |
440 | if (++count > 99) { | 440 | if (++count > 99) { |
441 | break; | 441 | break; |
442 | } | 442 | } |
443 | } | 443 | } |
444 | return l; | 444 | return l; |
445 | } | 445 | } |
446 | 446 | ||
447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) |
448 | { | 448 | { |
449 | QString body(""); | 449 | QString body(""); |
450 | const char*mb; | 450 | const char*mb; |
451 | int err; | 451 | int err; |
452 | mailimap_fetch_type *fetchType; | 452 | mailimap_fetch_type *fetchType; |
453 | mailimap_set *set; | 453 | mailimap_set *set; |
454 | clistcell*current,*cur; | 454 | clistcell*current,*cur; |
455 | 455 | ||
456 | login(); | 456 | login(); |
457 | if (!m_imap) { | 457 | if (!m_imap) { |
458 | return body; | 458 | return body; |
459 | } | 459 | } |
460 | if (!internal_call) { | 460 | if (!internal_call) { |
461 | mb = mail.getMbox().latin1(); | 461 | mb = mail.getMbox().latin1(); |
462 | /* select mailbox READONLY for operations */ | 462 | err = mailimap_select( m_imap, (char*)mb); |
463 | err = mailimap_examine( m_imap, (char*)mb); | ||
464 | if ( err != MAILIMAP_NO_ERROR ) { | 463 | if ( err != MAILIMAP_NO_ERROR ) { |
465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 464 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
466 | return body; | 465 | return body; |
467 | } | 466 | } |
468 | } | 467 | } |
469 | set = mailimap_set_new_single(mail.getNumber()); | 468 | set = mailimap_set_new_single(mail.getNumber()); |
470 | clist*id_list=clist_new(); | 469 | clist*id_list=clist_new(); |
471 | for (unsigned j=0; j < path.count();++j) { | 470 | for (unsigned j=0; j < path.count();++j) { |
472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 471 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
473 | *p_id = path[j]; | 472 | *p_id = path[j]; |
474 | clist_append(id_list,p_id); | 473 | clist_append(id_list,p_id); |
475 | } | 474 | } |
476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | 475 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); |
477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 476 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
478 | mailimap_section * section = mailimap_section_new(section_spec); | 477 | mailimap_section * section = mailimap_section_new(section_spec); |
479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 478 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
480 | 479 | ||
481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 480 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
482 | 481 | ||
483 | clist*result = clist_new(); | 482 | clist*result = clist_new(); |
484 | 483 | ||
485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 484 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
486 | mailimap_set_free( set ); | 485 | mailimap_set_free( set ); |
487 | mailimap_fetch_type_free( fetchType ); | 486 | mailimap_fetch_type_free( fetchType ); |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 7b75ffa..3941cec 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -310,50 +310,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
310 | m->setFlags(mFlags); | 310 | m->setFlags(mFlags); |
311 | m->setMsgsize(size); | 311 | m->setMsgsize(size); |
312 | } | 312 | } |
313 | return m; | 313 | return m; |
314 | } | 314 | } |
315 | 315 | ||
316 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) | 316 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) |
317 | { | 317 | { |
318 | RecBody body; | 318 | RecBody body; |
319 | const char *mb; | 319 | const char *mb; |
320 | int err = MAILIMAP_NO_ERROR; | 320 | int err = MAILIMAP_NO_ERROR; |
321 | clist *result; | 321 | clist *result; |
322 | clistcell *current; | 322 | clistcell *current; |
323 | mailimap_fetch_att *fetchAtt; | 323 | mailimap_fetch_att *fetchAtt; |
324 | mailimap_fetch_type *fetchType; | 324 | mailimap_fetch_type *fetchType; |
325 | mailimap_set *set; | 325 | mailimap_set *set; |
326 | mailimap_body*body_desc; | 326 | mailimap_body*body_desc; |
327 | 327 | ||
328 | mb = mail.getMbox().latin1(); | 328 | mb = mail.getMbox().latin1(); |
329 | 329 | ||
330 | login(); | 330 | login(); |
331 | if (!m_imap) { | 331 | if (!m_imap) { |
332 | return body; | 332 | return body; |
333 | } | 333 | } |
334 | /* select mailbox READONLY for operations */ | 334 | |
335 | err = mailimap_examine( m_imap, (char*)mb); | 335 | err = mailimap_select( m_imap, (char*)mb); |
336 | if ( err != MAILIMAP_NO_ERROR ) { | 336 | if ( err != MAILIMAP_NO_ERROR ) { |
337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
338 | return body; | 338 | return body; |
339 | } | 339 | } |
340 | 340 | ||
341 | result = clist_new(); | 341 | result = clist_new(); |
342 | /* the range has to start at 1!!! not with 0!!!! */ | 342 | /* the range has to start at 1!!! not with 0!!!! */ |
343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
346 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 346 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
347 | mailimap_set_free( set ); | 347 | mailimap_set_free( set ); |
348 | mailimap_fetch_type_free( fetchType ); | 348 | mailimap_fetch_type_free( fetchType ); |
349 | 349 | ||
350 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 350 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
351 | mailimap_msg_att * msg_att; | 351 | mailimap_msg_att * msg_att; |
352 | msg_att = (mailimap_msg_att*)current->data; | 352 | msg_att = (mailimap_msg_att*)current->data; |
353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
354 | body_desc = item->att_data.att_static->att_data.att_body; | 354 | body_desc = item->att_data.att_static->att_data.att_body; |
355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { | 355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { |
356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | 358 | qDebug("Mulitpart mail"); |
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); | 359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); |
@@ -438,50 +438,49 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
438 | } | 438 | } |
439 | l.append(QString(from)); | 439 | l.append(QString(from)); |
440 | if (++count > 99) { | 440 | if (++count > 99) { |
441 | break; | 441 | break; |
442 | } | 442 | } |
443 | } | 443 | } |
444 | return l; | 444 | return l; |
445 | } | 445 | } |
446 | 446 | ||
447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) |
448 | { | 448 | { |
449 | QString body(""); | 449 | QString body(""); |
450 | const char*mb; | 450 | const char*mb; |
451 | int err; | 451 | int err; |
452 | mailimap_fetch_type *fetchType; | 452 | mailimap_fetch_type *fetchType; |
453 | mailimap_set *set; | 453 | mailimap_set *set; |
454 | clistcell*current,*cur; | 454 | clistcell*current,*cur; |
455 | 455 | ||
456 | login(); | 456 | login(); |
457 | if (!m_imap) { | 457 | if (!m_imap) { |
458 | return body; | 458 | return body; |
459 | } | 459 | } |
460 | if (!internal_call) { | 460 | if (!internal_call) { |
461 | mb = mail.getMbox().latin1(); | 461 | mb = mail.getMbox().latin1(); |
462 | /* select mailbox READONLY for operations */ | 462 | err = mailimap_select( m_imap, (char*)mb); |
463 | err = mailimap_examine( m_imap, (char*)mb); | ||
464 | if ( err != MAILIMAP_NO_ERROR ) { | 463 | if ( err != MAILIMAP_NO_ERROR ) { |
465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 464 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
466 | return body; | 465 | return body; |
467 | } | 466 | } |
468 | } | 467 | } |
469 | set = mailimap_set_new_single(mail.getNumber()); | 468 | set = mailimap_set_new_single(mail.getNumber()); |
470 | clist*id_list=clist_new(); | 469 | clist*id_list=clist_new(); |
471 | for (unsigned j=0; j < path.count();++j) { | 470 | for (unsigned j=0; j < path.count();++j) { |
472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 471 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
473 | *p_id = path[j]; | 472 | *p_id = path[j]; |
474 | clist_append(id_list,p_id); | 473 | clist_append(id_list,p_id); |
475 | } | 474 | } |
476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | 475 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); |
477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 476 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
478 | mailimap_section * section = mailimap_section_new(section_spec); | 477 | mailimap_section * section = mailimap_section_new(section_spec); |
479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 478 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
480 | 479 | ||
481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 480 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
482 | 481 | ||
483 | clist*result = clist_new(); | 482 | clist*result = clist_new(); |
484 | 483 | ||
485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 484 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
486 | mailimap_set_free( set ); | 485 | mailimap_set_free( set ); |
487 | mailimap_fetch_type_free( fetchType ); | 486 | mailimap_fetch_type_free( fetchType ); |