From 81d92d4b8a3b61d289907a78abbcab68185ea045 Mon Sep 17 00:00:00 2001 From: Michael Haeckel Date: Fri, 30 Nov 2001 18:49:59 +0000 Subject: [PATCH] Remove some code duplication and hopefully fix the interval mail checking starts while manual checking is still in progress problem. Actually I still don't fully understand, how this could happen, since there is double security and only one security layer obviously had a bug. svn path=/trunk/kdenetwork/kmail/; revision=124869 --- kmacctmgr.cpp | 67 ++++++--------------------------------------------- kmacctmgr.h | 1 - 2 files changed, 7 insertions(+), 61 deletions(-) diff --git a/kmacctmgr.cpp b/kmacctmgr.cpp index 703f6f147..83a24d307 100644 --- a/kmacctmgr.cpp +++ b/kmacctmgr.cpp @@ -248,7 +248,6 @@ bool KMAcctMgr::remove(KMAccount* acct) void KMAcctMgr::checkMail(bool _interactive) { newMailArrived = false; - interactive = _interactive; if (checking) return; @@ -261,54 +260,14 @@ void KMAcctMgr::checkMail(bool _interactive) return; } - checking = true; - - kernel->serverReady (false); - mAccountIt->toFirst(); - lastAccountChecked = 0; - processNextAccount(false); -} - -void KMAcctMgr::processNextAccount(bool _newMail) -{ - KMAccount *cur = mAccountIt->current(); - newMailArrived |= _newMail; - if (lastAccountChecked) - disconnect( lastAccountChecked, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - - if (!cur) { - kernel->filterMgr()->cleanup(); - kdDebug(5006) << "checked mail, server ready" << endl; - kernel->serverReady (true); - checking = false; - emit checkedMail(newMailArrived, TRUE); - return; + while (TRUE) + { + if (!mAccountIt->current()->checkExclude()) + singleCheckMail(mAccountIt->current(), _interactive); + if (mAccountIt->atLast()) break; + ++(*mAccountIt); } - - connect( cur, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - - lastAccountChecked = cur; - ++(*mAccountIt); - - if (cur->type() != "imap" && cur->folder() == 0) - { - QString tmp; - tmp = i18n("Account %1 has no mailbox defined!\n" - "Mail checking aborted\n" - "Check your account settings!") - .arg(cur->name()); - KMessageBox::information(0,tmp); - processNextAccount(false); - } - else if (cur->checkExclude()) - { - // Account excluded from mail check. - processNextAccount(false); - } - else cur->processNewMail(interactive); } @@ -330,7 +289,6 @@ void KMAcctMgr::intCheckMail(int item, bool _interactive) { KMAccount* cur; newMailArrived = false; - interactive = _interactive; if (checking) return; @@ -364,18 +322,7 @@ void KMAcctMgr::intCheckMail(int item, bool _interactive) { return; } - checking = true; - - kdDebug(5006) << "checking mail, server busy" << endl; - kernel->serverReady (false); - - mAccountIt->toLast(); - ++(*mAccountIt); - - lastAccountChecked = cur; - connect( cur, SIGNAL(finishedCheck(bool)), - this, SLOT(processNextAccount(bool)) ); - cur->processNewMail(interactive); + singleCheckMail(cur, _interactive); } diff --git a/kmacctmgr.h b/kmacctmgr.h index b5660fac4..3d39c2bb9 100644 --- a/kmacctmgr.h +++ b/kmacctmgr.h @@ -63,7 +63,6 @@ public slots: virtual void singleCheckMail(KMAccount *, bool _interactive = true); virtual void intCheckMail(int, bool _interactive = true); - virtual void processNextAccount(bool newMail); virtual void processNextCheck(bool _newMail); signals: