summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-27 22:05:42 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-27 22:05:42 -0500
commita4c62fbcea26b13c3c9f1a6a306960809dfe831a (patch)
tree913929d158938c96b93c7a12bdae2bc5cea1cb8a
parentf820c4f9253bbc21156ee90ad22e6d9deae29034 (diff)
downloadtdepim-a4c62fbcea26b13c3c9f1a6a306960809dfe831a.tar.gz
tdepim-a4c62fbcea26b13c3c9f1a6a306960809dfe831a.zip
Fix expiry when set to zero days
Improve logging of expiry job
-rw-r--r--kmail/expirejob.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/kmail/expirejob.cpp b/kmail/expirejob.cpp
index a208b918b..be5003b3d 100644
--- a/kmail/expirejob.cpp
+++ b/kmail/expirejob.cpp
@@ -79,17 +79,17 @@ void ExpireJob::kill()
void ExpireJob::execute()
{
- mMaxUnreadTime = 0;
- mMaxReadTime = 0;
+ mMaxUnreadTime = -1;
+ mMaxReadTime = -1;
mCurrentIndex = 0;
int unreadDays, readDays;
mSrcFolder->daysToExpire( unreadDays, readDays );
- if (unreadDays > 0) {
+ if (unreadDays >= 0) {
kdDebug(5006) << "ExpireJob: deleting unread older than "<< unreadDays << " days" << endl;
mMaxUnreadTime = time(0) - unreadDays * 3600 * 24;
}
- if (readDays > 0) {
+ if (readDays >= 0) {
kdDebug(5006) << "ExpireJob: deleting read older than "<< readDays << " days" << endl;
mMaxReadTime = time(0) - readDays * 3600 * 24;
}
@@ -123,15 +123,28 @@ void ExpireJob::slotDoWork()
#endif
for( ; mCurrentIndex >= stopIndex; mCurrentIndex-- ) {
const KMMsgBase *mb = storage->getMsgBase( mCurrentIndex );
+#ifdef DEBUG_SCHEDULER
+ kdDebug(5006) << "ExpireJob: checking message " << mCurrentIndex << " existence" << endl;
+#endif
if (mb == 0)
continue;
+#ifdef DEBUG_SCHEDULER
+ kdDebug(5006) << "ExpireJob: checking message " << mCurrentIndex << " importance" << endl;
+#endif
if ( ( mb->isImportant() || mb->isTodo() || mb->isWatched() )
&& GlobalSettings::self()->excludeImportantMailFromExpiry() )
continue;
+#ifdef DEBUG_SCHEDULER
+ kdDebug(5006) << "ExpireJob: checking message " << mCurrentIndex << " time" << endl;
+#endif
time_t maxTime = mb->isUnread() ? mMaxUnreadTime : mMaxReadTime;
+#ifdef DEBUG_SCHEDULER
+ kdDebug(5006) << "ExpireJob: checking message " << mCurrentIndex << " time (" << mb->date() << " vs " << maxTime << ")" << endl;
+#endif
if (mb->date() < maxTime) {
+ kdDebug(5006) << "ExpireJob: expiring message " << mCurrentIndex << " from folder " << mSrcFolder->location() << endl;
mRemovedMsgs.append( storage->getMsgBase( mCurrentIndex ) );
}
}