-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 | |||
@@ -61,7 +61,7 @@ void IMAPwrapper::progress( QString m ) | |||
61 | static QString mProgrMess; | 61 | static QString mProgrMess; |
62 | if ( m != QString::null ) { | 62 | if ( m != QString::null ) { |
63 | mProgrMess = m; | 63 | mProgrMess = m; |
64 | mCurrent = 0; | 64 | mCurrent = 1; |
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | QString mess; | 67 | QString mess; |
@@ -69,6 +69,7 @@ void IMAPwrapper::progress( QString m ) | |||
69 | if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); | 69 | if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); |
70 | else mess = mProgrMess +tr(" message %1").arg( mCurrent++); | 70 | else mess = mProgrMess +tr(" message %1").arg( mCurrent++); |
71 | Global::statusMessage(mess); | 71 | Global::statusMessage(mess); |
72 | qDebug("Progress %s %s", mess.latin1(), m.latin1()); | ||
72 | qApp->processEvents(); | 73 | qApp->processEvents(); |
73 | } | 74 | } |
74 | bool IMAPwrapper::start_tls(bool force_tls) | 75 | bool IMAPwrapper::start_tls(bool force_tls) |
@@ -233,6 +234,9 @@ void IMAPwrapper::logout() | |||
233 | 234 | ||
234 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) | 235 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
235 | { | 236 | { |
237 | |||
238 | int tryAgain = 1; | ||
239 | while ( tryAgain >= 0 ) { | ||
236 | int err = MAILIMAP_NO_ERROR; | 240 | int err = MAILIMAP_NO_ERROR; |
237 | clist *result = 0; | 241 | clist *result = 0; |
238 | clistcell *current; | 242 | clistcell *current; |
@@ -256,11 +260,15 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
256 | return; | 260 | return; |
257 | } else { | 261 | } else { |
258 | } | 262 | } |
259 | 263 | progress( tr("Fetch ")); | |
264 | mMax = last; | ||
265 | //qDebug("last %d ", last); | ||
260 | Global::statusMessage(tr("Fetching header list")); | 266 | Global::statusMessage(tr("Fetching header list")); |
261 | qApp->processEvents(); | 267 | qApp->processEvents(); |
262 | /* the range has to start at 1!!! not with 0!!!! */ | 268 | /* the range has to start at 1!!! not with 0!!!! */ |
263 | set = mailimap_set_new_interval( 1, last ); | 269 | //LR the access to web.de imap server is no working with value 1 |
270 | qDebug("interval %d - %d ", tryAgain, last-1+tryAgain ); | ||
271 | set = mailimap_set_new_interval( tryAgain, last ); | ||
264 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 272 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
265 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 273 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
266 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); | 274 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
@@ -274,10 +282,12 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
274 | QString date,subject,from; | 282 | QString date,subject,from; |
275 | 283 | ||
276 | if ( err == MAILIMAP_NO_ERROR ) { | 284 | if ( err == MAILIMAP_NO_ERROR ) { |
285 | tryAgain = -1; | ||
277 | mailimap_msg_att * msg_att; | 286 | mailimap_msg_att * msg_att; |
278 | int i = 0; | 287 | int i = 0; |
279 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 288 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
280 | ++i; | 289 | ++i; |
290 | //qDebug("iii %d ",i); | ||
281 | msg_att = (mailimap_msg_att*)current->data; | 291 | msg_att = (mailimap_msg_att*)current->data; |
282 | RecMail*m = parse_list_result(msg_att); | 292 | RecMail*m = parse_list_result(msg_att); |
283 | if (m) { | 293 | if (m) { |
@@ -291,10 +301,17 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
291 | } | 301 | } |
292 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); | 302 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); |
293 | } else { | 303 | } else { |
304 | --tryAgain; | ||
305 | --tryAgain; | ||
306 | if ( tryAgain < 0 ) | ||
294 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); | 307 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); |
308 | else | ||
309 | qDebug("try again... "); | ||
295 | } | 310 | } |
311 | |||
296 | if (result) mailimap_fetch_list_free(result); | 312 | if (result) mailimap_fetch_list_free(result); |
297 | } | 313 | } |
314 | } | ||
298 | 315 | ||
299 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | 316 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
300 | { | 317 | { |
@@ -952,7 +969,7 @@ void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | |||
952 | 969 | ||
953 | 970 | ||
954 | mMax = count; | 971 | mMax = count; |
955 | //progress( tr("Delete")); | 972 | progress( tr("Delete")); |
956 | 973 | ||
957 | QProgressBar wid ( count ); | 974 | QProgressBar wid ( count ); |
958 | wid.setCaption( tr("Deleting ...")); | 975 | wid.setCaption( tr("Deleting ...")); |