From: teranisi Date: Tue, 31 Aug 2004 13:22:26 +0000 (+0000) Subject: * modb-standard.el (modb-standard-digest-flags): Abolish. X-Git-Tag: wl-2_11_31~30 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=d176e2fbfeafe2cded18663cd3f0edb49dfde064;p=elisp%2Fwanderlust.git * modb-standard.el (modb-standard-digest-flags): Abolish. (elmo-msgdb-list-flagged): Use elmo-digest-flags instead. * elmo-vars.el (elmo-digest-flags): New variable. (elmo-preserved-flags): Moved from elmo-flag.el. * elmo-imap4.el (elmo-imap4-flag-to-imap-search-key): New function. (elmo-imap4-flag-to-imap-criteria): Ditto. (elmo-imap4-folder-list-flagged): Use it. * elmo-flag.el (elmo-preserved-flags): Moved to elmo-vars.el. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index f755d10..903900a 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,17 @@ 2004-08-31 Yuuichi Teranishi + * modb-standard.el (modb-standard-digest-flags): Abolish. + (elmo-msgdb-list-flagged): Use elmo-digest-flags instead. + + * elmo-vars.el (elmo-digest-flags): New variable. + (elmo-preserved-flags): Moved from elmo-flag.el. + + * elmo-imap4.el (elmo-imap4-flag-to-imap-search-key): New function. + (elmo-imap4-flag-to-imap-criteria): Ditto. + (elmo-imap4-folder-list-flagged): Use it. + + * elmo-flag.el (elmo-preserved-flags): Moved to elmo-vars.el. + * elmo.el (elmo-folder-count-flags): Changed return value. * elmo-flag.el (elmo-preserved-flags): New variable. diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index 781b31b..f667d17 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -30,10 +30,6 @@ (eval-when-compile (require 'cl)) ;;; Code: -(defcustom elmo-preserved-flags '(answered cached new unread) - "Reserved flags which are not treated as global." - :type '(repeat (symbol :tag "flag"))) - (defcustom elmo-global-flag-list '(important) "A list of flag symbol which is managed globally by the flag folder." :type '(repeat symbol) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 8b0296b..4bfcebe 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -763,28 +763,50 @@ Returns response value if selecting folder succeed. " (t (member "\\*" (elmo-imap4-session-flags-internal session))))) +(defun elmo-imap4-flag-to-imap-search-key (flag) + (case flag + (read "seen") + (unread "unseen") + (important "flagged") + (answered "answered") + (new "new") + (t (concat + "keyword " + (or (car (cdr (assq flag elmo-imap4-flag-specs))) + (symbol-name flag)))))) + +(defun elmo-imap4-flag-to-imap-criteria (flag) + (case flag + ((any digest) + (let ((criteria "flagged") + (global-flags (delq 'important (elmo-get-global-flags t t)))) + (dolist (flag (delete 'new + (delete 'cached + (copy-sequence + (case flag + (any + elmo-preserved-flags) + (digest + elmo-digest-flags)))))) + (setq criteria (concat "or " + (elmo-imap4-flag-to-imap-search-key flag) + " " + criteria))) + (while global-flags + (setq criteria (concat "or keyword " + (symbol-name (car global-flags)) + " " + criteria)) + (setq global-flags (cdr global-flags))) + criteria)) + (t + (elmo-imap4-flag-to-imap-search-key flag)))) + (defun elmo-imap4-folder-list-flagged (folder flag) "List flagged message numbers in the FOLDER. FLAG is one of the `unread', `read', `important', `answered', `any'." (let ((session (elmo-imap4-get-session folder)) - (criteria (case flag - (read "seen") - (unread "unseen") - (important "flagged") - (answered "answered") - (new "new") - (any "or answered or unseen flagged") - (digest "or unseen flagged") - (t (concat "keyword " (capitalize (symbol-name flag))))))) - ;; Add search keywords - (when (or (eq flag 'digest)(eq flag 'any)) - (let ((flags (delq 'important (elmo-get-global-flags t t)))) - (while flags - (setq criteria (concat "or keyword " - (symbol-name (car flags)) - " " - criteria)) - (setq flags (cdr flags))))) + (criteria (elmo-imap4-flag-to-imap-criteria flag))) (if (elmo-imap4-session-flag-available-p session flag) (progn (elmo-imap4-session-select-mailbox diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index 80d5380..0e887af 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -57,6 +57,16 @@ :prefix "elmo-" :group 'elmo) +(defcustom elmo-digest-flags '(unread) + "Flags which are treated as `digest'." + :type '(repeat (symbol :tag "flag")) + :group 'elmo) + +(defcustom elmo-preserved-flags '(answered cached new unread) + "Reserved flags which are not treated as global." + :type '(repeat (symbol :tag "flag")) + :group 'elmo) + ;; Message Database (defcustom elmo-msgdb-default-type 'legacy diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index f538ea6..0f90e29 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -49,9 +49,6 @@ (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. @@ -366,7 +363,7 @@ (setq matched (cons (car entry) matched)))) (modb-standard-flag-map msgdb))) (digest - (let ((flags (append modb-standard-digest-flags + (let ((flags (append elmo-digest-flags (elmo-get-global-flags t t)))) (mapatoms (lambda (atom)