author | zautrix <zautrix> | 2004-10-18 10:57:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-18 10:57:05 (UTC) |
commit | a83b6694d2f80ec58f6eb88684897052c69276a0 (patch) (side-by-side diff) | |
tree | 4b20f33e874f035f54021638125ed293e4202613 /kmicromail | |
parent | 112db6c41265da5255a58424186d95d7a00b6ff0 (diff) | |
download | kdepimpi-a83b6694d2f80ec58f6eb88684897052c69276a0.zip kdepimpi-a83b6694d2f80ec58f6eb88684897052c69276a0.tar.gz kdepimpi-a83b6694d2f80ec58f6eb88684897052c69276a0.tar.bz2 |
some mail imap changes
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index b0dd1b8..a6688ed 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -60,16 +60,17 @@ void IMAPwrapper::progress( QString m ) static QString mProgrMess; if ( m != QString::null ) { mProgrMess = m; - mCurrent = 0; + mCurrent = 1; return; } QString mess; //qDebug("progress "); if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); else mess = mProgrMess +tr(" message %1").arg( mCurrent++); Global::statusMessage(mess); + qDebug("Progress %s %s", mess.latin1(), m.latin1()); qApp->processEvents(); } bool IMAPwrapper::start_tls(bool force_tls) { @@ -232,8 +233,11 @@ void IMAPwrapper::logout() } void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) { + + int tryAgain = 1; + while ( tryAgain >= 0 ) { int err = MAILIMAP_NO_ERROR; clist *result = 0; clistcell *current; mailimap_fetch_type *fetchType = 0; @@ -255,13 +259,17 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma Global::statusMessage(tr("Mailbox has no mails")); return; } else { } - + progress( tr("Fetch ")); + mMax = last; + //qDebug("last %d ", last); Global::statusMessage(tr("Fetching header list")); qApp->processEvents(); /* the range has to start at 1!!! not with 0!!!! */ - set = mailimap_set_new_interval( 1, last ); + //LR the access to web.de imap server is no working with value 1 + qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); + set = mailimap_set_new_interval( tryAgain, last ); fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); @@ -273,12 +281,14 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma QString date,subject,from; if ( err == MAILIMAP_NO_ERROR ) { + tryAgain = -1; mailimap_msg_att * msg_att; int i = 0; for (current = clist_begin(result); current != 0; current=clist_next(current)) { ++i; + //qDebug("iii %d ",i); msg_att = (mailimap_msg_att*)current->data; RecMail*m = parse_list_result(msg_att); if (m) { if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { @@ -290,12 +300,19 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma } } Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); } else { + --tryAgain; + --tryAgain; + if ( tryAgain < 0 ) Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); + else + qDebug("try again... "); } + if (result) mailimap_fetch_list_free(result); } +} QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() { const char *path, *mask; @@ -951,9 +968,9 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) // qDebug("imap remove count %d ", count); mMax = count; - //progress( tr("Delete")); + progress( tr("Delete")); QProgressBar wid ( count ); wid.setCaption( tr("Deleting ...")); wid.show(); |