* modb-standard.el (modb-standard-digest-flags): New variable.
authorteranisi <teranisi>
Tue, 31 Aug 2004 07:51:54 +0000 (07:51 +0000)
committerteranisi <teranisi>
Tue, 31 Aug 2004 07:51:54 +0000 (07:51 +0000)
(elmo-msgdb-list-flagged): Use it for `digest'; Add `uncached';
Changed behavior of `any'.

* elmo-imap4.el (elmo-imap4-flag-specs): Added keyword flags
which are defined the Internet draft
(draft-melnikov-imap-keywords-03.txt).
(elmo-imap4-flags-to-imap): New function.
(elmo-folder-append-buffer): Use it.

* modb-legacy.el (modb-legacy-answered-uncached-mark): Fixed typo
in the docstring.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/modb-legacy.el
elmo/modb-standard.el

index ee38703..8ae0e56 100644 (file)
@@ -1,5 +1,18 @@
 2004-08-31  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * modb-standard.el (modb-standard-digest-flags): New variable.
+       (elmo-msgdb-list-flagged): Use it for `digest'; Add `uncached';
+       Changed behavior of `any'.
+
+       * elmo-imap4.el (elmo-imap4-flag-specs): Added keyword flags
+       which are defined the Internet draft
+       (draft-melnikov-imap-keywords-03.txt).
+       (elmo-imap4-flags-to-imap): New function.
+       (elmo-folder-append-buffer): Use it.
+
+       * modb-legacy.el (modb-legacy-answered-uncached-mark): Fixed typo
+       in the docstring.
+
        * utf7.el (utf7-fragment-encode): Don't use narrow-to-region to
        avoid the bug of Emacs 21.3.
 
index 0690bda..8b0296b 100644 (file)
@@ -167,7 +167,12 @@ REGEXP should have a grouping for namespace prefix.")
 (defconst elmo-imap4-flag-specs '((important "\\Flagged")
                                  (read "\\Seen")
                                  (unread "\\Seen" 'remove)
-                                 (answered "\\Answered")))
+                                 (answered "\\Answered")
+                                 ;; draft-melnikov-imap-keywords-03.txt
+                                 (forwarded "$Forwarded")
+                                 (work "$Work")
+                                 (personal "$Personal")
+                                 (shouldreply "$ShouldReply")))
 
 ;; For debugging.
 (defvar elmo-imap4-debug nil
@@ -2561,6 +2566,17 @@ If optional argument REMOVE is non-nil, remove FLAG."
         (elmo-imap4-mailbox
          (elmo-imap4-folder-mailbox-internal folder)))))
 
+(defun elmo-imap4-flags-to-imap (flags)
+  "Convert FLAGS to the IMAP flag string."
+  (let ((imap-flag (if (not (memq 'unread flags)) "\\Seen"))
+       (flags (delq 'cached (delq 'unread flags)))
+       spec)
+    (dolist (flag flags)
+      (setq imap-flag (concat imap-flag (if imap-flag " ")
+                             (or (car (cdr (assq flag elmo-imap4-flag-specs)))
+                                 (capitalize (symbol-name flag))))))
+    imap-flag))
+
 (luna-define-method elmo-folder-append-buffer
   ((folder elmo-imap4-folder) &optional flags number)
   (if (elmo-folder-plugged-p folder)
@@ -2579,19 +2595,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
                    (elmo-imap4-mailbox (elmo-imap4-folder-mailbox-internal
                                         folder))
                    (if (and flags (elmo-folder-use-flag-p folder))
-                       (concat " ("
-                               (mapconcat
-                                'identity
-                                (append
-                                 (and (memq 'important flags)
-                                      '("\\Flagged"))
-                                 (and (not (memq 'unread flags))
-                                      '("\\Seen"))
-                                 (and (memq 'answered flags)
-                                      '("\\Answered")))
-                                " ")
-                               ;; XX KEYWORD flags
-                               ") ")
+                       (concat " (" (elmo-imap4-flags-to-imap flags) ") ")
                      " () ")
                    (elmo-imap4-buffer-literal send-buffer))))
          (kill-buffer send-buffer))
index 4022ad2..9adf900 100644 (file)
@@ -54,7 +54,7 @@
   "Mark for answered and cached message.")
 
 (defconst modb-legacy-answered-uncached-mark "A"
-  "Mark for answered but cached message.")
+  "Mark for answered but uncached message.")
 
 (defconst modb-legacy-important-mark "$"
   "Mark for important message.")
index 4d69c83..f538ea6 100644 (file)
@@ -49,6 +49,9 @@
 (defvar modb-standard-msgid-filename "msgid"
   "Message number <=> Message-Id database.")
 
+(defvar modb-standard-digest-flags '(unread)
+  "Flags which are listed as `digest'.")
+
 (eval-and-compile
   (luna-define-class modb-standard (modb-generic)
                     (number-list       ; sorted list of message numbers.
    (modb-standard-number-list-internal msgdb)))
 
 (luna-define-method elmo-msgdb-list-flagged ((msgdb modb-standard) flag)
-  (let ((flags (case flag
-                (digest
-                 (append '(unread) (elmo-get-global-flags t t)))
-                (any
-                 (append '(unread answered) (elmo-get-global-flags t t)))))
-       entry matched)
+  (let (entry matched)
     (case flag
       (read
        (dolist (number (modb-standard-number-list-internal msgdb))
         (unless (memq 'unread (modb-standard-message-flags msgdb number))
           (setq matched (cons number matched)))))
-      ((digest any)
+      (uncached
+       (dolist (number (modb-standard-number-list-internal msgdb))
+        (unless (memq 'cached (modb-standard-message-flags msgdb number))
+          (setq matched (cons number matched)))))
+      (any
        (mapatoms
        (lambda (atom)
          (setq entry (symbol-value atom))
-         (when (modb-standard-match-flags flags (cdr entry))
+         (unless (and (eq (length (cdr entry)) 1)
+                      (eq (car (cdr entry)) 'cached))
+           ;; If there is a flag other than cached, then the message
+           ;; matches to `any'.
            (setq matched (cons (car entry) matched))))
        (modb-standard-flag-map msgdb)))
+      (digest
+       (let ((flags (append modb-standard-digest-flags
+                           (elmo-get-global-flags t t))))
+        (mapatoms
+         (lambda (atom)
+           (setq entry (symbol-value atom))
+           (when (modb-standard-match-flags flags (cdr entry))
+             (setq matched (cons (car entry) matched))))
+         (modb-standard-flag-map msgdb))))
       (t
        (mapatoms
        (lambda (atom)