Allow returning the cutoff time for oldness in addition to being a predicate.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 21 Sep 2010 16:58:02 +0000 (18:58 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 21 Sep 2010 16:58:02 +0000 (18:58 +0200)
lisp/ChangeLog
lisp/nnmail.el

index 84baaff..9fdac2c 100644 (file)
@@ -1,5 +1,8 @@
 2010-09-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 2010-09-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * nnmail.el (nnmail-expired-article-p): Allow returning the cutoff time
+       for oldness in addition to being a predicate.
+
        * nnimap.el (nnimap-request-group): When we have zero articles, return
        the right data to Gnus.
        (nnimap-request-expire-articles): Only delete articles immediately if
        * nnimap.el (nnimap-request-group): When we have zero articles, return
        the right data to Gnus.
        (nnimap-request-expire-articles): Only delete articles immediately if
index 3e6cee8..e17465a 100644 (file)
@@ -1858,9 +1858,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
       (run-hooks 'nnmail-post-get-new-mail-hook))))
 
 (defun nnmail-expired-article-p (group time force &optional inhibit)
       (run-hooks 'nnmail-post-get-new-mail-hook))))
 
 (defun nnmail-expired-article-p (group time force &optional inhibit)
-  "Say whether an article that is TIME old in GROUP should be expired."
+  "Say whether an article that is TIME old in GROUP should be expired.
+If TIME is nil, then return the cutoff time for oldness instead."
   (if force
   (if force
-      t
+      (if (null time)
+         (current-time)
+       t)
     (let ((days (or (and nnmail-expiry-wait-function
                         (funcall nnmail-expiry-wait-function group))
                    nnmail-expiry-wait)))
     (let ((days (or (and nnmail-expiry-wait-function
                         (funcall nnmail-expiry-wait-function group))
                    nnmail-expiry-wait)))
@@ -1871,14 +1874,18 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
             nil)
            ((eq days 'immediate)
             ;; We expire all articles on sight.
             nil)
            ((eq days 'immediate)
             ;; We expire all articles on sight.
-            t)
+            (if (null time)
+                (current-time)
+              t))
            ((equal time '(0 0))
            ;; This is an ange-ftp group, and we don't have any dates.
             nil)
            ((numberp days)
             (setq days (days-to-time days))
             ;; Compare the time with the current time.
            ((equal time '(0 0))
            ;; This is an ange-ftp group, and we don't have any dates.
             nil)
            ((numberp days)
             (setq days (days-to-time days))
             ;; Compare the time with the current time.
-            (ignore-errors (time-less-p days (time-since time))))))))
+            (if (null time)
+                (time-minus (current-time) days)
+              (ignore-errors (time-less-p days (time-since time)))))))))
 
 (declare-function gnus-group-mark-article-read "gnus-group" (group article))
 
 
 (declare-function gnus-group-mark-article-read "gnus-group" (group article))