diff --git a/accountmanager.cpp b/accountmanager.cpp index a2c0428ba..e729a0f04 100644 --- a/accountmanager.cpp +++ b/accountmanager.cpp @@ -113,6 +113,12 @@ void AccountManager::singleCheckMail(KMAccount *account, bool interactive) mNewMailArrived = false; mInteractive = interactive; + // if sync has been requested by the user then check if check-interval was disabled by user, if yes, then + // de-install the timer + // Safe guard against an infinite sync loop (kolab/issue2607) + if ( mInteractive ) + account->readTimerConfig(); + // queue the account mAcctTodo.append(account); diff --git a/kmaccount.cpp b/kmaccount.cpp index 4ad181c25..65222dd4b 100644 --- a/kmaccount.cpp +++ b/kmaccount.cpp @@ -163,6 +163,16 @@ void KMAccount::readConfig(KConfig& config) installTimer(); } +void KMAccount::readTimerConfig() +{ + // Re-reads and checks check-interval value and deinstalls timer incase check-interval + // for mail check is disabled. + // Or else, the mail sync goes into a infinite loop (kolab/issue2607) + if (mInterval == 0) + deinstallTimer(); + else + installTimer(); +} //----------------------------------------------------------------------------- void KMAccount::writeConfig(KConfig& config) diff --git a/kmaccount.h b/kmaccount.h index 14a2548ae..0f903938b 100644 --- a/kmaccount.h +++ b/kmaccount.h @@ -142,6 +142,7 @@ public: * already properly set by the caller. */ virtual void readConfig(KConfig& config); + virtual void readTimerConfig(); /** * Write all account information to given config file. The config group