From: teranisi Date: Tue, 31 Aug 2004 07:51:54 +0000 (+0000) Subject: * modb-standard.el (modb-standard-digest-flags): New variable. X-Git-Tag: wl-2_11_31~33 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=587abf2e735114afd441181263674c4b18a42598;p=elisp%2Fwanderlust.git * 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. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index ee38703..8ae0e56 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,18 @@ 2004-08-31 Yuuichi Teranishi + * 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. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 0690bda..8b0296b 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -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)) diff --git a/elmo/modb-legacy.el b/elmo/modb-legacy.el index 4022ad2..9adf900 100644 --- a/elmo/modb-legacy.el +++ b/elmo/modb-legacy.el @@ -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.") diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index 4d69c83..f538ea6 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -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. @@ -342,24 +345,35 @@ (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)