summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 ) );
}
}