summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Sanders <don.sanders@nokia.com>2011-06-22 22:44:12 +1000
committerDon Sanders <don.sanders@nokia.com>2011-06-22 22:44:12 +1000
commit183451e9a1290042670607e13fb5191fb026ecec (patch)
treeba4f3157f171d4a06b58afd9d4de2992c7c32b56
parent18c817bbab6c47f13c6e5ebe65e5185d6e05f1e0 (diff)
Ensure expiry timer is running for push email mail checks.
Related to build [REQ: 716994] no NB currently.
-rw-r--r--src/plugins/messageservices/imap/imapservice.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/messageservices/imap/imapservice.cpp b/src/plugins/messageservices/imap/imapservice.cpp
index f8e51380..5df086af 100644
--- a/src/plugins/messageservices/imap/imapservice.cpp
+++ b/src/plugins/messageservices/imap/imapservice.cpp
@@ -99,6 +99,7 @@ public:
connect(_service->_client, SIGNAL(idleNewMailNotification(QMailFolderId)), this, SLOT(queueMailCheck(QMailFolderId)));
connect(_service->_client, SIGNAL(idleFlagsChangedNotification(QMailFolderId)), this, SLOT(queueFlagsChangedCheck()));
connect(_service->_client, SIGNAL(matchingMessageIds(QMailMessageIdList)), this, SIGNAL(matchingMessageIds(QMailMessageIdList)));
+ connect(&_strategyExpiryTimer, SIGNAL(timeout()), this, SLOT(expireStrategy()));
}
void setIntervalTimer(int interval)
@@ -151,6 +152,8 @@ public slots:
void intervalCheck();
void queueMailCheck(QMailFolderId folderId);
void queueFlagsChangedCheck();
+ void resetExpiryTimer();
+ void expireStrategy();
private:
bool doDelete(const QMailMessageIdList & ids);
@@ -175,6 +178,7 @@ private:
quint64 _setMask;
quint64 _unsetMask;
QList<QPair<ImapStrategy*, QLatin1String> > _pendingStrategies;
+ QTimer _strategyExpiryTimer; // Required to expire interval mail check triggered by push email
};
bool ImapService::Source::retrieveFolderList(const QMailAccountId &accountId, const QMailFolderId &folderId, bool descending)
@@ -1054,6 +1058,7 @@ bool ImapService::Source::setStrategy(ImapStrategy *strategy, const char *signal
connect(this, SIGNAL(messageActionCompleted(QMailMessageIdList)), this, signal);
}
+ resetExpiryTimer();
_unavailable = true;
_service->_client->setStrategy(strategy);
_service->_client->newConnection();
@@ -1106,6 +1111,7 @@ void ImapService::Source::messageActionCompleted(const QString &uid)
void ImapService::Source::retrievalCompleted()
{
+ _strategyExpiryTimer.stop();
_unavailable = false;
_setMask = 0;
_unsetMask = 0;
@@ -1205,6 +1211,7 @@ void ImapService::Source::queueFlagsChangedCheck()
void ImapService::Source::retrievalTerminated()
{
+ _strategyExpiryTimer.stop();
_unavailable = false;
_synchronizing = false;
if (_queuedMailCheckInProgress) {
@@ -1217,6 +1224,18 @@ void ImapService::Source::retrievalTerminated()
_flagsCheckQueued = false;
}
+void ImapService::Source::resetExpiryTimer()
+{
+ static const int ExpirySeconds = 180; // Should be larger than imapservice.h value
+ _strategyExpiryTimer.start(ExpirySeconds * 1000);
+}
+
+void ImapService::Source::expireStrategy()
+{
+ qMailLog(Messaging) << "IMAP Strategy is not progressing. Internally reseting IMAP service for account" << _service->_accountId;
+ _service->disable();
+ _service->enable();
+}
ImapService::ImapService(const QMailAccountId &accountId)
: QMailMessageService(),
@@ -1245,6 +1264,7 @@ void ImapService::enable()
_establishingPushEmail = false;
_pushRetry = ThirtySeconds;
connect(_client, SIGNAL(progressChanged(uint, uint)), this, SIGNAL(progressChanged(uint, uint)));
+ connect(_client, SIGNAL(progressChanged(uint, uint)), _source, SLOT(resetExpiryTimer()));
connect(_client, SIGNAL(errorOccurred(int, QString)), this, SLOT(errorOccurred(int, QString)));
connect(_client, SIGNAL(errorOccurred(QMailServiceAction::Status::ErrorCode, QString)), this, SLOT(errorOccurred(QMailServiceAction::Status::ErrorCode, QString)));
connect(_client, SIGNAL(updateStatus(QString)), this, SLOT(updateStatus(QString)));