(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.
2004-08-31 Yuuichi Teranishi <teranisi@gohome.org>
+ * 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.
(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)
(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
: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
(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.
(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)