2001-08-12 Simon Josefsson <jas@extundo.com>
authorSimon Josefsson <jas@extundo.com>
Sat, 11 Aug 2001 22:56:44 +0000 (22:56 +0000)
committerSimon Josefsson <jas@extundo.com>
Sat, 11 Aug 2001 22:56:44 +0000 (22:56 +0000)
Suggested by Kai.Grossjohann@CS.Uni-Dortmund.DE

Support `recent' mark indicating newly arrived messages (to
separate from old but unread messages).

* nnimap.el (nnimap-retrieve-groups): Push dummy article into
`nnmail-split-history' if recent is > 0.
(nnimap-request-update-info-internal): Update `recent' marks.
(nnimap-request-set-mark): Never set `recent' marks.
(nnimap-mark-to-predicate-alist, nnimap-mark-to-flag-alist): Add
recent.

* gnus-sum.el (gnus-recent-mark): New mark.
(gnus-newsgroup-recent): New variable.
(gnus-summary-local-variables): Add gnus-newsgroup-recent.
(gnus-summary-prepare-threads): Mark recent articles.
(gnus-summary-add-mark): Support recent.
(gnus-summary-update-secondary-mark): Support recent.

* gnus.el (gnus-article-mark-lists): Add recent.

lisp/ChangeLog
lisp/gnus-sum.el
lisp/nnimap.el

index c202ca8..3e15240 100644 (file)
@@ -1,3 +1,25 @@
+2001-08-12  Simon Josefsson  <jas@extundo.com>
+       Suggested by Kai.Grossjohann@CS.Uni-Dortmund.DE
+
+       Support `recent' mark indicating newly arrived messages (to
+       separate from old but unread messages).
+       
+       * nnimap.el (nnimap-retrieve-groups): Push dummy article into
+       `nnmail-split-history' if recent is > 0.
+       (nnimap-request-update-info-internal): Update `recent' marks.
+       (nnimap-request-set-mark): Never set `recent' marks.
+       (nnimap-mark-to-predicate-alist, nnimap-mark-to-flag-alist): Add
+       recent.
+
+       * gnus-sum.el (gnus-recent-mark): New mark.
+       (gnus-newsgroup-recent): New variable.
+       (gnus-summary-local-variables): Add gnus-newsgroup-recent.
+       (gnus-summary-prepare-threads): Mark recent articles.
+       (gnus-summary-add-mark): Support recent.
+       (gnus-summary-update-secondary-mark): Support recent.
+
+       * gnus.el (gnus-article-mark-lists): Add recent.
+
 2001-08-12  Simon Josefsson  <jas@extundo.com>
 
        * mm-bodies.el (mm-decode-content-transfer-encoding): Returns
index b01ed3f..fd8bd4e 100644 (file)
@@ -439,6 +439,11 @@ this variable specifies group names."
   :group 'gnus-summary-marks
   :type 'character)
 
+(defcustom gnus-recent-mark ?N
+  "*Mark used for articles that are recent."
+  :group 'gnus-summary-marks
+  :type 'character)
+
 (defcustom gnus-cached-mark ?*
   "*Mark used for articles that are in the cache."
   :group 'gnus-summary-marks
@@ -1147,6 +1152,9 @@ the type of the variable (string, integer, character, etc).")
 (defvar gnus-newsgroup-forwarded nil
   "List of articles that have been forwarded in the current newsgroup.")
 
+(defvar gnus-newsgroup-recent nil
+  "List of articles that have are recent in the current newsgroup.")
+
 (defvar gnus-newsgroup-expirable nil
   "List of articles in the current newsgroup that can be expired.")
 
@@ -1205,6 +1213,7 @@ the type of the variable (string, integer, character, etc).")
     gnus-newsgroup-unselected gnus-newsgroup-marked
     gnus-newsgroup-reads gnus-newsgroup-saved
     gnus-newsgroup-replied gnus-newsgroup-forwarded
+    gnus-newsgroup-recent
     gnus-newsgroup-expirable
     gnus-newsgroup-processable gnus-newsgroup-killed
     gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
@@ -4320,6 +4329,8 @@ or a straight list of headers."
                    gnus-forwarded-mark)
                   ((memq number gnus-newsgroup-saved)
                    gnus-saved-mark)
+                  ((memq number gnus-newsgroup-recent)
+                   gnus-recent-mark)
                   (t gnus-no-mark))
             gnus-tmp-from (mail-header-from gnus-tmp-header)
             gnus-tmp-name
@@ -8594,9 +8605,9 @@ the actual number of articles unmarked is returned."
        (error "No such mark type: %s" type)
       (setq var (intern (format "gnus-newsgroup-%s" type)))
       (set var (cons article (symbol-value var)))
-      (if (memq type '(processable cached replied forwarded saved))
+      (if (memq type '(processable cached replied forwarded recent saved))
          (gnus-summary-update-secondary-mark article)
-       ;;; !!! This is bobus.  We should find out what primary
+       ;;; !!! This is bogus.  We should find out what primary
        ;;; !!! mark we want to set.
        (gnus-summary-update-mark gnus-del-mark 'unread)))))
 
@@ -8854,6 +8865,8 @@ Iff NO-EXPIRE, auto-expiry will be inhibited."
          gnus-forwarded-mark)
         ((memq article gnus-newsgroup-saved)
          gnus-saved-mark)
+        ((memq article gnus-newsgroup-recent)
+         gnus-recent-mark)
         (t gnus-no-mark))
    'replied)
   (when (gnus-visual-p 'summary-highlight 'highlight)
index 47952c1..edea544 100644 (file)
@@ -866,6 +866,10 @@ function is generally only called when Gnus is shutting down."
        (or (member "\\NoSelect"
                    (imap-mailbox-get 'list-flags group nnimap-server-buffer))
            (let ((info (nnimap-find-minmax-uid group 'examine)))
+             (when (> (or (imap-mailbox-get 'recent group 
+                                            nnimap-server-buffer) 0)
+                      0)
+               (push (list (cons group 0)) nnmail-split-history))
              (insert (format "\"%s\" %d %d y\n" group
                              (or (nth 2 info) 0)
                              (max 1 (or (nth 1 info) 1))))))))
@@ -902,9 +906,10 @@ function is generally only called when Gnus is shutting down."
            (gnus-info-set-read info seen)))
 
        (mapcar (lambda (pred)
-                 (when (and (nnimap-mark-permanent-p (cdr pred))
-                            (member (nnimap-mark-to-flag (cdr pred))
-                                    (imap-mailbox-get 'flags)))
+                 (when (or (eq (cdr pred) 'recent)
+                           (and (nnimap-mark-permanent-p (cdr pred))
+                                (member (nnimap-mark-to-flag (cdr pred))
+                                        (imap-mailbox-get 'flags))))
                    (gnus-info-set-marks
                     info
                     (nnimap-update-alist-soft
@@ -950,6 +955,8 @@ function is generally only called when Gnus is shutting down."
                marks)
            ;; cache flags are pointless on the server
            (setq cmdmarks (delq 'cache cmdmarks))
+           ;; recent marks can't be set
+           (setq cmdmarks (delq 'recent cmdmarks))
            (when nnimap-importantize-dormant
              ;; flag dormant articles as ticked
              (if (memq 'dormant cmdmarks)
@@ -1293,6 +1300,7 @@ function is generally only called when Gnus is shutting down."
                '((read . "SEEN")
                  (tick . "FLAGGED")
                  (draft . "DRAFT")
+                 (recent . "RECENT")
                  (reply . "ANSWERED")))
         (cons (cdr pair)
               (format "KEYWORD gnus-%s" (symbol-name (cdr pair))))))
@@ -1311,6 +1319,7 @@ to be used within a IMAP SEARCH query."
                '((read . "\\Seen")
                  (tick . "\\Flagged")
                  (draft . "\\Draft")
+                 (recent . "\\Recent")
                  (reply . "\\Answered")))
         (cons (cdr pair)
               (format "gnus-%s" (symbol-name (cdr pair))))))