author | alwin <alwin> | 2004-10-24 00:55:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-24 00:55:14 (UTC) |
commit | 9755bc969d17fc683791abc5c6fbd50fa3112486 (patch) (unidiff) | |
tree | 0fdcf7b52b2f4627dd3efcd7330b116c4d9c4d98 /noncore/net/mail/libmailwrapper/imapwrapper.cpp | |
parent | 12eed25c7f18285f0e342d49fd3c41eb4b14e151 (diff) | |
download | opie-9755bc969d17fc683791abc5c6fbd50fa3112486.zip opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.gz opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.bz2 |
new options for pop3 accounts
KATE eated a lot of last spaces in files
some tryouts
Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 9b7c0e0..fe75a15 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -32,5 +32,5 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
32 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 32 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
33 | if ( err != MAILIMAP_NO_ERROR ) { | 33 | if ( err != MAILIMAP_NO_ERROR ) { |
34 | odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl; | 34 | odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl; |
35 | m_Lastmbox = ""; | 35 | m_Lastmbox = ""; |
36 | return err; | 36 | return err; |
@@ -43,5 +43,5 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | |||
43 | { | 43 | { |
44 | qApp->processEvents(); | 44 | qApp->processEvents(); |
45 | odebug << "IMAP: " << current << " of " << maximum << "" << oendl; | 45 | odebug << "IMAP: " << current << " of " << maximum << "" << oendl; |
46 | } | 46 | } |
47 | 47 | ||
@@ -55,5 +55,5 @@ bool IMAPwrapper::start_tls(bool force_tls) | |||
55 | if (err != MAILIMAP_NO_ERROR) { | 55 | if (err != MAILIMAP_NO_ERROR) { |
56 | Global::statusMessage("error getting capabilities!"); | 56 | Global::statusMessage("error getting capabilities!"); |
57 | odebug << "error getting capabilities!" << oendl; | 57 | odebug << "error getting capabilities!" << oendl; |
58 | return false; | 58 | return false; |
59 | } | 59 | } |
@@ -76,5 +76,5 @@ bool IMAPwrapper::start_tls(bool force_tls) | |||
76 | if (err != MAILIMAP_NO_ERROR && force_tls) { | 76 | if (err != MAILIMAP_NO_ERROR && force_tls) { |
77 | Global::statusMessage(tr("Server has no TLS support!")); | 77 | Global::statusMessage(tr("Server has no TLS support!")); |
78 | odebug << "Server has no TLS support!" << oendl; | 78 | odebug << "Server has no TLS support!" << oendl; |
79 | try_tls = false; | 79 | try_tls = false; |
80 | } else { | 80 | } else { |
@@ -127,5 +127,5 @@ void IMAPwrapper::login() | |||
127 | } else { | 127 | } else { |
128 | // cancel | 128 | // cancel |
129 | odebug << "IMAP: Login canceled" << oendl; | 129 | odebug << "IMAP: Login canceled" << oendl; |
130 | return; | 130 | return; |
131 | } | 131 | } |
@@ -150,5 +150,5 @@ void IMAPwrapper::login() | |||
150 | 150 | ||
151 | if ( ssl ) { | 151 | if ( ssl ) { |
152 | odebug << "using ssl" << oendl; | 152 | odebug << "using ssl" << oendl; |
153 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 153 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
154 | } else { | 154 | } else { |
@@ -178,5 +178,5 @@ void IMAPwrapper::login() | |||
178 | if (force_tls && !try_tls) { | 178 | if (force_tls && !try_tls) { |
179 | Global::statusMessage(tr("Server has no TLS support!")); | 179 | Global::statusMessage(tr("Server has no TLS support!")); |
180 | odebug << "Server has no TLS support!" << oendl; | 180 | odebug << "Server has no TLS support!" << oendl; |
181 | ok = false; | 181 | ok = false; |
182 | } | 182 | } |
@@ -238,4 +238,8 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
238 | /* the range has to start at 1!!! not with 0!!!! */ | 238 | /* the range has to start at 1!!! not with 0!!!! */ |
239 | set = mailimap_set_new_interval( 1, last ); | 239 | set = mailimap_set_new_interval( 1, last ); |
240 | |||
241 | |||
242 | fetchType = mailimap_fetch_type_new_all(); | ||
243 | /* | ||
240 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 244 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
241 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 245 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
@@ -243,5 +247,5 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
243 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 247 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
244 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | 248 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
245 | 249 | */ | |
246 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 250 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
247 | mailimap_set_free( set ); | 251 | mailimap_set_free( set ); |
@@ -319,5 +323,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
319 | } | 323 | } |
320 | } else { | 324 | } else { |
321 | odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; | 325 | odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; |
322 | } | 326 | } |
323 | mailimap_list_result_free( result ); | 327 | mailimap_list_result_free( result ); |
@@ -329,5 +333,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
329 | path = account->getPrefix().latin1(); | 333 | path = account->getPrefix().latin1(); |
330 | if (!path) path = ""; | 334 | if (!path) path = ""; |
331 | odebug << path << oendl; | 335 | odebug << path << oendl; |
332 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 336 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
333 | if ( err == MAILIMAP_NO_ERROR ) { | 337 | if ( err == MAILIMAP_NO_ERROR ) { |
@@ -356,5 +360,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
356 | } | 360 | } |
357 | } else { | 361 | } else { |
358 | odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; | 362 | odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; |
359 | } | 363 | } |
360 | if (result) mailimap_list_result_free( result ); | 364 | if (result) mailimap_list_result_free( result ); |
@@ -376,8 +380,8 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
376 | return m; | 380 | return m; |
377 | } | 381 | } |
382 | size = 0; | ||
378 | m = new RecMail(); | 383 | m = new RecMail(); |
379 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 384 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
380 | current = c; | 385 | current = c; |
381 | size = 0; | ||
382 | item = (mailimap_msg_att_item*)current->data; | 386 | item = (mailimap_msg_att_item*)current->data; |
383 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 387 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
@@ -466,11 +470,18 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
466 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 470 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
467 | #if 0 | 471 | #if 0 |
468 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 472 | mailimap_date_time*date = item->att_data.att_static->att_data.att_internal_date; |
473 | if (date->dt_sec>60 || date->dt_sec<0) date->dt_sec=0; | ||
474 | //QDateTime da(QDate(d->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); | ||
475 | QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; | ||
476 | timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; | ||
477 | timestring.sprintf(timestring+" %+05i",date->dt_zone); | ||
478 | m->setDate(timestring); | ||
469 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 479 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
470 | odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; | 480 | odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; |
471 | odebug << da.toString() << oendl; | 481 | odebug << da.toString() << oendl; |
472 | #endif | 482 | #endif |
473 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 483 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
474 | size = item->att_data.att_static->att_data.att_rfc822_size; | 484 | //size = item->att_data.att_static->att_data.att_rfc822_size; |
485 | m->setMsgsize(item->att_data.att_static->att_data.att_rfc822_size); | ||
475 | } | 486 | } |
476 | } | 487 | } |
@@ -482,5 +493,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
482 | if (m) { | 493 | if (m) { |
483 | m->setFlags(mFlags); | 494 | m->setFlags(mFlags); |
484 | m->setMsgsize(size); | ||
485 | } | 495 | } |
486 | return m; | 496 | return m; |
@@ -526,5 +536,5 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | |||
526 | traverseBody(mail,body_desc,body,0,path); | 536 | traverseBody(mail,body_desc,body,0,path); |
527 | } else { | 537 | } else { |
528 | odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; | 538 | odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; |
529 | } | 539 | } |
530 | if (result) mailimap_fetch_list_free(result); | 540 | if (result) mailimap_fetch_list_free(result); |
@@ -638,5 +648,5 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
638 | } | 648 | } |
639 | } else { | 649 | } else { |
640 | odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; | 650 | odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
641 | } | 651 | } |
642 | if (result) mailimap_fetch_list_free(result); | 652 | if (result) mailimap_fetch_list_free(result); |
@@ -665,5 +675,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
665 | id+=QString("%1").arg(countlist[j]); | 675 | id+=QString("%1").arg(countlist[j]); |
666 | } | 676 | } |
667 | odebug << "ID = " << id.latin1() << "" << oendl; | 677 | odebug << "ID = " << id.latin1() << "" << oendl; |
668 | currentPart->setIdentifier(id); | 678 | currentPart->setIdentifier(id); |
669 | fillSinglePart(currentPart,part1); | 679 | fillSinglePart(currentPart,part1); |
@@ -706,5 +716,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
706 | id+=QString("%1").arg(countlist[j]); | 716 | id+=QString("%1").arg(countlist[j]); |
707 | } | 717 | } |
708 | odebug << "ID(mpart) = " << id.latin1() << "" << oendl; | 718 | odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
709 | } | 719 | } |
710 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 720 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
@@ -750,5 +760,5 @@ void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_tex | |||
750 | QString sub; | 760 | QString sub; |
751 | sub = which->bd_media_text; | 761 | sub = which->bd_media_text; |
752 | odebug << "Type= text/" << which->bd_media_text << "" << oendl; | 762 | odebug << "Type= text/" << which->bd_media_text << "" << oendl; |
753 | target_part->setSubtype(sub.lower()); | 763 | target_part->setSubtype(sub.lower()); |
754 | target_part->setLines(which->bd_lines); | 764 | target_part->setLines(which->bd_lines); |
@@ -762,5 +772,5 @@ void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg* | |||
762 | } | 772 | } |
763 | target_part->setSubtype("rfc822"); | 773 | target_part->setSubtype("rfc822"); |
764 | odebug << "Message part" << oendl; | 774 | odebug << "Message part" << oendl; |
765 | /* we set this type to text/plain */ | 775 | /* we set this type to text/plain */ |
766 | target_part->setLines(which->bd_lines); | 776 | target_part->setLines(which->bd_lines); |
@@ -821,5 +831,5 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba | |||
821 | sub = ""; | 831 | sub = ""; |
822 | } | 832 | } |
823 | odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; | 833 | odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; |
824 | target_part->setType(type.lower()); | 834 | target_part->setType(type.lower()); |
825 | target_part->setSubtype(sub.lower()); | 835 | target_part->setSubtype(sub.lower()); |
@@ -897,14 +907,14 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) | |||
897 | 907 | ||
898 | if (err != MAILIMAP_NO_ERROR) { | 908 | if (err != MAILIMAP_NO_ERROR) { |
899 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 909 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
900 | return; | 910 | return; |
901 | } | 911 | } |
902 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 912 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
903 | /* should we realy do that at this moment? */ | 913 | /* should we realy do that at this moment? */ |
904 | err = mailimap_expunge(m_imap); | 914 | err = mailimap_expunge(m_imap); |
905 | if (err != MAILIMAP_NO_ERROR) { | 915 | if (err != MAILIMAP_NO_ERROR) { |
906 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 916 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
907 | } | 917 | } |
908 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; | 918 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
909 | } | 919 | } |
910 | 920 | ||
@@ -932,5 +942,5 @@ void IMAPwrapper::answeredMail(const RecMailP&mail) | |||
932 | 942 | ||
933 | if (err != MAILIMAP_NO_ERROR) { | 943 | if (err != MAILIMAP_NO_ERROR) { |
934 | odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; | 944 | odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; |
935 | return; | 945 | return; |
936 | } | 946 | } |
@@ -1000,5 +1010,5 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
1000 | return 0; | 1010 | return 0; |
1001 | } | 1011 | } |
1002 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 1012 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1003 | /* should we realy do that at this moment? */ | 1013 | /* should we realy do that at this moment? */ |
1004 | err = mailimap_expunge(m_imap); | 1014 | err = mailimap_expunge(m_imap); |
@@ -1007,5 +1017,5 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
1007 | return 0; | 1017 | return 0; |
1008 | } | 1018 | } |
1009 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; | 1019 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
1010 | return 1; | 1020 | return 1; |
1011 | } | 1021 | } |
@@ -1032,5 +1042,5 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons | |||
1032 | } | 1042 | } |
1033 | } | 1043 | } |
1034 | odebug << "Creating " << pre.latin1() << "" << oendl; | 1044 | odebug << "Creating " << pre.latin1() << "" << oendl; |
1035 | int res = mailimap_create(m_imap,pre.latin1()); | 1045 | int res = mailimap_create(m_imap,pre.latin1()); |
1036 | if (res != MAILIMAP_NO_ERROR) { | 1046 | if (res != MAILIMAP_NO_ERROR) { |
@@ -1091,5 +1101,5 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
1091 | } | 1101 | } |
1092 | } else { | 1102 | } else { |
1093 | odebug << "Error retrieving status" << oendl; | 1103 | odebug << "Error retrieving status" << oendl; |
1094 | } | 1104 | } |
1095 | if (status) mailimap_mailbox_data_status_free(status); | 1105 | if (status) mailimap_mailbox_data_status_free(status); |
@@ -1115,5 +1125,5 @@ MAILLIB::ATYPE IMAPwrapper::getType()const | |||
1115 | const QString&IMAPwrapper::getName()const | 1125 | const QString&IMAPwrapper::getName()const |
1116 | { | 1126 | { |
1117 | odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; | 1127 | odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; |
1118 | return account->getAccountName(); | 1128 | return account->getAccountName(); |
1119 | } | 1129 | } |
@@ -1131,5 +1141,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1131 | if (targetWrapper != this) { | 1141 | if (targetWrapper != this) { |
1132 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 1142 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); |
1133 | odebug << "Using generic" << oendl; | 1143 | odebug << "Using generic" << oendl; |
1134 | return; | 1144 | return; |
1135 | } | 1145 | } |
@@ -1150,5 +1160,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1150 | QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); | 1160 | QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); |
1151 | Global::statusMessage(error_msg); | 1161 | Global::statusMessage(error_msg); |
1152 | odebug << error_msg << oendl; | 1162 | odebug << error_msg << oendl; |
1153 | return; | 1163 | return; |
1154 | } | 1164 | } |
@@ -1161,5 +1171,5 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra | |||
1161 | { | 1171 | { |
1162 | if (targetWrapper != this) { | 1172 | if (targetWrapper != this) { |
1163 | odebug << "Using generic" << oendl; | 1173 | odebug << "Using generic" << oendl; |
1164 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 1174 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
1165 | return; | 1175 | return; |
@@ -1180,5 +1190,5 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra | |||
1180 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); | 1190 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); |
1181 | Global::statusMessage(error_msg); | 1191 | Global::statusMessage(error_msg); |
1182 | odebug << error_msg << oendl; | 1192 | odebug << error_msg << oendl; |
1183 | return; | 1193 | return; |
1184 | } | 1194 | } |