From: hmurata Date: Sun, 11 Jan 2004 14:05:34 +0000 (+0000) Subject: * wl-summary.el (wl-summary-mark-as-read-all): Follow the API X-Git-Tag: wl-2_11_24~46 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=063537db84b5bfc89a5c54abb90e1eeb7f2cdf14;p=elisp%2Fwanderlust.git * wl-summary.el (wl-summary-mark-as-read-all): Follow the API change. (wl-summary-sync-marks): Ditto. (wl-summary-mark-as-read-internal): Ditto. (wl-summary-mark-as-answered-internal): Ditto. (wl-summary-mark-as-important-internal): Ditto. (wl-summary-reply): Ditto. * wl-draft.el (wl-draft-kill): Use `elmo-folder-unset-flag' instead of `elmo-folder-unflag-answered'. * elmo-pipe.el (elmo-folder-list-unreads, elmo-folder-list-answereds, elmo-folder-list-importants, elmo-folder-flag-as-important, elmo-folder-unflag-important, elmo-folder-flag-as-read, elmo-folder-unflag-read, elmo-folder-flag-as-answered, elmo-folder-unflag-answered): Remove. (elmo-folder-set-flag): Define. (elmo-folder-unset-flag): Ditto. * elmo-nntp.el (elmo-folder-flag-as-read): Remove. (elmo-folder-set-flag): Define. (elmo-folder-unset-flag): Ditto. (elmo-folder-list-unreads): Remove. (elmo-folder-list-flagged): Define. * elmo-net.el (elmo-folder-list-flagged-internal): Define. (elmo-folder-list-unreads, elmo-folder-list-importants, elmo-folder-list-answereds, elmo-folder-list-unreads-plugged, elmo-folder-list-importants-plugged, elmo-folder-list-answereds-plugged): Remove. (elmo-folder-list-flagged-plugged): New method. (elmo-folder-unflag-important, elmo-folder-flag-as-important, elmo-folder-unflag-read, elmo-folder-flag-as-read, elmo-folder-unflag-answered, elmo-folder-flag-as-answered, elmo-folder-flag-as-read-unplugged, elmo-folder-unflag-read-unplugged, elmo-folder-flag-as-important-unplugged, elmo-folder-unflag-important-unplugged, elmo-folder-flag-as-answered-unplugged, elmo-folder-unflag-answered-unplugged): Remove. (elmo-folder-set-flag): Define. (elmo-folder-unset-flag): Ditto. (elmo-folder-set-flag-unplugged): Ditto. (elmo-folder-unset-flag-unplugged): Ditto. * elmo-multi.el (elmo-folder-list-unreads, elmo-folder-list-answereds, elmo-folder-list-importants, elmo-folder-flag-as-important, elmo-folder-unflag-important, elmo-folder-flag-as-read, elmo-folder-unflag-read, elmo-folder-flag-as-answered, elmo-folder-unflag-answered): Remove. (elmo-folder-set-flag): Define. (elmo-folder-unset-flag): Ditto. * elmo-map.el (elmo-map-folder-unflag-important, elmo-map-folder-flag-as-important, elmo-map-folder-unflag-read, elmo-map-folder-flag-as-read, elmo-map-folder-unflag-answered, elmo-map-folder-flag-as-answered): Remove. (elmo-map-folder-set-flag): New method. (elmo-map-folder-unset-flag): Ditto. (elmo-map-folder-list-unreads, elmo-map-folder-list-importants, elmo-map-folder-list-answereds): Remove. (elmo-folder-list-flagged-internal): Define. (elmo-map-folder-list-flagged): New method. * elmo-maildir.el (elmo-maildir-flag-specs): New internal variable. (elmo-map-folder-list-unreads, elmo-map-folder-list-importants, elmo-map-folder-list-flagged): Remove. (elmo-map-folder-list-flagged): Define. (elmo-map-folder-flag-as-important, elmo-map-folder-unflag-important, elmo-map-folder-flag-as-read, elmo-map-folder-unflag-read, elmo-map-folder-flag-as-answered, elmo-map-folder-unflag-answered): Remove. (elmo-maildir-set-mark-messages): New internal function. (elmo-map-folder-set-flag): Define. (elmo-map-folder-unset-flag): Ditto. * elmo.el (toplevel): Added autoload setting for `elmo-folder-list-global-flag-messages'. (elmo-folder-list-unreads, elmo-folder-list-importants, elmo-folder-list-answereds): Remove. (elmo-folder-list-flagged): Use `elmo-folder-list-flagged-internal'. Return a list whitch merged with messages have global flag. (elmo-folder-list-flagged-internal): New method. (elmo-folder-unflag-important, elmo-folder-flag-as-important, elmo-folder-unflag-read, elmo-folder-flag-as-read, elmo-folder-unflag-answered, elmo-folder-flag-as-answered): Remove. (elmo-folder-set-flag): New method. (elmo-folder-unset-flag): Ditto. (elmo-message-set-flag):Use `elmo-folder-set-flag'. (elmo-message-unset-flag):Use `elmo-folder-unset-flag'. * elmo-imap4.el (elmo-imap4-flag-specs): New internal variable. (elmo-folder-list-unreads-plugged, elmo-folder-list-importants-plugged, elmo-folder-list-answereds-plugged, elmo-folder-list-flagged-unplugged, elmo-folder-unflag-important-plugged, elmo-folder-flag-as-important-plugged, elmo-folder-unflag-read-plugged, elmo-folder-flag-as-read-plugged, elmo-folder-unflag-answered-plugged, elmo-folder-flag-as-answered-plugged): Remove. (elmo-folder-set-flag-plugged, elmo-folder-unset-flag-plugged): Define. * elmo-flag.el (elmo-folder-initialize): Register to `elmo-global-flag-list' if flag is not global. (elmo-folder-append-messages): Set flag to source messages. * elmo-filter.el (elmo-filter-folder-list-unreads, elmo-folder-list-unreads, elmo-filter-folder-list-importants, elmo-folder-list-importants, elmo-folder-flag-as-read, elmo-folder-unflag-read, elmo-folder-flag-as-important, elmo-folder-unflag-important, elmo-folder-flag-as-answered, elmo-folder-unflag-answered): Remove. (elmo-folder-set-flag): Define. (elmo-folder-unset-flag): Ditto. * elmo-dop.el (elmo-folder-flag-as-read-dop, elmo-folder-unflag-read-dop, elmo-folder-flag-as-important-dop, elmo-folder-unflag-important-dop, elmo-folder-flag-as-answered-dop, elmo-folder-unflag-answered-dop): Remove. (elmo-folder-set-flag-dop, elmo-folder-unset-flag-dop, elmo-folder-set-important-delayed, elmo-folder-unset-important-delayed, elmo-folder-set-read-delayed, elmo-folder-unset-read-delayed, elmo-folder-set-answered-delayed, elmo-folder-unset-answered-delayed): New function. (elmo-dop-queue-merge-method-list): Follow the above chagned. (elmo-dop-queue-method-name-alist): Ditto. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 5c2bbac..e9ab7c9 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,156 @@ 2004-01-11 Hiroya Murata + * elmo-pipe.el (elmo-folder-list-unreads, + elmo-folder-list-answereds, + elmo-folder-list-importants, + elmo-folder-flag-as-important, + elmo-folder-unflag-important, + elmo-folder-flag-as-read, + elmo-folder-unflag-read, + elmo-folder-flag-as-answered, + elmo-folder-unflag-answered): Remove. + (elmo-folder-set-flag): Define. + (elmo-folder-unset-flag): Ditto. + + * elmo-nntp.el (elmo-folder-flag-as-read): Remove. + (elmo-folder-set-flag): Define. + (elmo-folder-unset-flag): Ditto. + (elmo-folder-list-unreads): Remove. + (elmo-folder-list-flagged): Define. + + * elmo-net.el (elmo-folder-list-flagged-internal): Define. + (elmo-folder-list-unreads, + elmo-folder-list-importants, + elmo-folder-list-answereds, + elmo-folder-list-unreads-plugged, + elmo-folder-list-importants-plugged, + elmo-folder-list-answereds-plugged): Remove. + (elmo-folder-list-flagged-plugged): New method. + (elmo-folder-unflag-important, + elmo-folder-flag-as-important, + elmo-folder-unflag-read, + elmo-folder-flag-as-read, + elmo-folder-unflag-answered, + elmo-folder-flag-as-answered, + elmo-folder-flag-as-read-unplugged, + elmo-folder-unflag-read-unplugged, + elmo-folder-flag-as-important-unplugged, + elmo-folder-unflag-important-unplugged, + elmo-folder-flag-as-answered-unplugged, + elmo-folder-unflag-answered-unplugged): Remove. + (elmo-folder-set-flag): Define. + (elmo-folder-unset-flag): Ditto. + (elmo-folder-set-flag-unplugged): Ditto. + (elmo-folder-unset-flag-unplugged): Ditto. + + * elmo-multi.el (elmo-folder-list-unreads, + elmo-folder-list-answereds, + elmo-folder-list-importants, + elmo-folder-flag-as-important, + elmo-folder-unflag-important, + elmo-folder-flag-as-read, + elmo-folder-unflag-read, + elmo-folder-flag-as-answered, + elmo-folder-unflag-answered): Remove. + (elmo-folder-set-flag): Define. + (elmo-folder-unset-flag): Ditto. + + * elmo-map.el (elmo-map-folder-unflag-important, + elmo-map-folder-flag-as-important, + elmo-map-folder-unflag-read, + elmo-map-folder-flag-as-read, + elmo-map-folder-unflag-answered, + elmo-map-folder-flag-as-answered): Remove. + (elmo-map-folder-set-flag): New method. + (elmo-map-folder-unset-flag): Ditto. + (elmo-map-folder-list-unreads, + elmo-map-folder-list-importants, + elmo-map-folder-list-answereds): Remove. + (elmo-folder-list-flagged-internal): Define. + (elmo-map-folder-list-flagged): New method. + + * elmo-maildir.el (elmo-maildir-flag-specs): New internal variable. + (elmo-map-folder-list-unreads, + elmo-map-folder-list-importants, + elmo-map-folder-list-flagged): Remove. + (elmo-map-folder-list-flagged): Define. + (elmo-map-folder-flag-as-important, + elmo-map-folder-unflag-important, + elmo-map-folder-flag-as-read, + elmo-map-folder-unflag-read, + elmo-map-folder-flag-as-answered, + elmo-map-folder-unflag-answered): Remove. + (elmo-maildir-set-mark-messages): New internal function. + (elmo-map-folder-set-flag): Define. + (elmo-map-folder-unset-flag): Ditto. + + * elmo.el (toplevel): Added autoload setting for + `elmo-folder-list-global-flag-messages'. + (elmo-folder-list-unreads, + elmo-folder-list-importants, + elmo-folder-list-answereds): Remove. + (elmo-folder-list-flagged): Use `elmo-folder-list-flagged-internal'. + Return a list whitch merged with messages have global flag. + (elmo-folder-list-flagged-internal): New method. + (elmo-folder-unflag-important, + elmo-folder-flag-as-important, + elmo-folder-unflag-read, + elmo-folder-flag-as-read, + elmo-folder-unflag-answered, + elmo-folder-flag-as-answered): Remove. + (elmo-folder-set-flag): New method. + (elmo-folder-unset-flag): Ditto. + (elmo-message-set-flag):Use `elmo-folder-set-flag'. + (elmo-message-unset-flag):Use `elmo-folder-unset-flag'. + + * elmo-imap4.el (elmo-imap4-flag-specs): New internal variable. + (elmo-folder-list-unreads-plugged, + elmo-folder-list-importants-plugged, + elmo-folder-list-answereds-plugged, + elmo-folder-list-flagged-unplugged, + elmo-folder-unflag-important-plugged, + elmo-folder-flag-as-important-plugged, + elmo-folder-unflag-read-plugged, + elmo-folder-flag-as-read-plugged, + elmo-folder-unflag-answered-plugged, + elmo-folder-flag-as-answered-plugged): Remove. + (elmo-folder-set-flag-plugged, + elmo-folder-unset-flag-plugged): Define. + + * elmo-flag.el (elmo-folder-initialize): Register to + `elmo-global-flag-list' if flag is not global. + (elmo-folder-append-messages): Set flag to source messages. + + * elmo-filter.el (elmo-filter-folder-list-unreads, + elmo-folder-list-unreads, + elmo-filter-folder-list-importants, + elmo-folder-list-importants, + elmo-folder-flag-as-read, + elmo-folder-unflag-read, + elmo-folder-flag-as-important, + elmo-folder-unflag-important, + elmo-folder-flag-as-answered, + elmo-folder-unflag-answered): Remove. + (elmo-folder-set-flag): Define. + (elmo-folder-unset-flag): Ditto. + + * elmo-dop.el (elmo-folder-flag-as-read-dop, + elmo-folder-unflag-read-dop, + elmo-folder-flag-as-important-dop, + elmo-folder-unflag-important-dop, + elmo-folder-flag-as-answered-dop, + elmo-folder-unflag-answered-dop): Remove. + (elmo-folder-set-flag-dop, + elmo-folder-unset-flag-dop, + elmo-folder-set-important-delayed, + elmo-folder-unset-important-delayed, + elmo-folder-set-read-delayed, + elmo-folder-unset-read-delayed, + elmo-folder-set-answered-delayed, + elmo-folder-unset-answered-delayed): New function. + (elmo-dop-queue-merge-method-list): Follow the above chagned. + (elmo-dop-queue-method-name-alist): Ditto. + * elmo-version.el (elmo-version): Up to 2.11.23. 2004-01-11 Yuuichi Teranishi diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 17faa0f..6565f94 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -63,24 +63,26 @@ Automatically loaded/saved.") (setq elmo-dop-queue (nconc elmo-dop-queue (list queue))))) (defvar elmo-dop-queue-merge-method-list - '(elmo-folder-flag-as-read - elmo-folder-unflag-read - elmo-folder-flag-as-important - elmo-folder-unflag-important - elmo-folder-flag-as-answered - elmo-folder-unflag-answered)) + '(elmo-folder-set-read-delayed + elmo-folder-unset-read-delayed + elmo-folder-set-important-delayed + elmo-folder-unset-important-delayed + elmo-folder-set-answered-delayed + elmo-folder-unset-answered-delayed)) (defvar elmo-dop-queue-method-name-alist '((elmo-folder-append-buffer-dop-delayed . "Append") (elmo-folder-delete-messages-dop-delayed . "Delete") (elmo-message-encache . "Encache") (elmo-folder-create-dop-delayed . "Create") - (elmo-folder-flag-as-read . "Read") - (elmo-folder-unflag-read . "Unread") - (elmo-folder-flag-as-answered . "Answered") - (elmo-folder-unflag-answered . "Unanswered") - (elmo-folder-flag-as-important . "Important") - (elmo-folder-unflag-important . "Unimportant"))) + (elmo-folder-set-read-delayed . "Read") + (elmo-folder-unset-read-delayed . "Unread") + (elmo-folder-set-answered-delayed . "Answered") + (elmo-folder-unset-answered-delayed . "Unanswered") + (elmo-folder-set-important-delayed . "Important") + (elmo-folder-unset-important-delayed . "Unimportant") + (elmo-folder-set-flag . "Set flag") + (elmo-folder-unset-flag . "Unset flag"))) (defmacro elmo-dop-queue-method-name (queue) `(cdr (assq (elmo-dop-queue-method ,queue) @@ -266,23 +268,35 @@ FOLDER is the folder structure." (defsubst elmo-folder-create-dop (folder) (elmo-dop-queue-append folder 'elmo-folder-create-dop-delayed nil)) -(defsubst elmo-folder-flag-as-read-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-flag-as-read (list numbers))) - -(defsubst elmo-folder-unflag-read-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unflag-read (list numbers))) - -(defsubst elmo-folder-flag-as-important-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-flag-as-important (list numbers))) - -(defsubst elmo-folder-unflag-important-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unflag-important (list numbers))) - -(defsubst elmo-folder-flag-as-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-flag-as-answered (list numbers))) - -(defsubst elmo-folder-unflag-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unflag-answered (list numbers))) +(defsubst elmo-folder-set-flag-dop (folder numbers flag) + (let ((method (case flag + (unread + 'elmo-folder-unset-read-delayed) + (read + 'elmo-folder-set-read-delayed) + (important + 'elmo-folder-set-important-delayed) + (answered + 'elmo-folder-set-answered-delayed)))) + (if method + (elmo-dop-queue-append folder method (list numbers)) + (elmo-dop-queue-append folder 'elmo-folder-set-flag + (list numbers flag))))) + +(defsubst elmo-folder-unset-flag-dop (folder numbers flag) + (let ((method (case flag + (unread + 'elmo-folder-set-read-delayed) + (read + 'elmo-folder-unset-read-delayed) + (important + 'elmo-folder-unset-important-delayed) + (answered + 'elmo-folder-unset-answered-delayed)))) + (if method + (elmo-dop-queue-append folder method (list numbers)) + (elmo-dop-queue-append folder 'elmo-folder-unset-flag + (list numbers flag))))) ;;; Execute as subsutitute for plugged operation. (defun elmo-folder-status-dop (folder) @@ -361,6 +375,24 @@ FOLDER is the folder structure." (unless (elmo-folder-exists-p folder) (elmo-folder-create folder))) +(defun elmo-folder-set-important-delayed (folder numbers) + (elmo-folder-set-flag folder numbers 'important)) + +(defun elmo-folder-unset-important-delayed (folder numbers) + (elmo-folder-unset-flag folder numbers 'important)) + +(defun elmo-folder-set-read-delayed (folder numbers) + (elmo-folder-set-flag folder numbers 'read)) + +(defun elmo-folder-unset-read-delayed (folder numbers) + (elmo-folder-unset-flag folder numbers 'read)) + +(defun elmo-folder-set-answered-delayed (folder numbers) + (elmo-folder-set-flag folder numbers 'answered)) + +(defun elmo-folder-unset-answered-delayed (folder numbers) + (elmo-folder-unset-flag folder numbers 'answered)) + ;;; Util (defun elmo-dop-msgdb (msgdb) (let ((new-db (elmo-make-msgdb)) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index b43fd34..5790196 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -170,30 +170,6 @@ ;; not available t))) -(defsubst elmo-filter-folder-list-unreads (folder) - (elmo-list-filter - (elmo-folder-list-messages folder nil 'in-msgdb) - (elmo-folder-list-unreads - (elmo-filter-folder-target-internal folder)))) - -(luna-define-method elmo-folder-list-unreads :around ((folder - elmo-filter-folder)) - (if (elmo-filter-folder-require-msgdb-internal folder) - (elmo-filter-folder-list-unreads folder) - (luna-call-next-method))) - -(defsubst elmo-filter-folder-list-importants (folder) - (elmo-list-filter - (elmo-folder-list-messages folder nil 'in-msgdb) - (elmo-folder-list-importants - (elmo-filter-folder-target-internal folder)))) - -(luna-define-method elmo-folder-list-importants :around ((folder - elmo-filter-folder)) - (if (elmo-filter-folder-require-msgdb-internal folder) - (elmo-filter-folder-list-importants folder) - (luna-call-next-method))) - (luna-define-method elmo-folder-list-subfolders ((folder elmo-filter-folder) &optional one-level) (let* ((target (elmo-filter-folder-target-internal folder)) @@ -279,58 +255,19 @@ (elmo-message-file-name (elmo-filter-folder-target-internal folder) number)) -(luna-define-method elmo-folder-flag-as-read :around ((folder - elmo-filter-folder) - numbers - &optional is-local) - (elmo-folder-flag-as-read (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) - -(luna-define-method elmo-folder-unflag-read :around ((folder - elmo-filter-folder) - numbers - &optional is-local) - (elmo-folder-unflag-read (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) - -(luna-define-method elmo-folder-flag-as-important :around ((folder - elmo-filter-folder) - numbers - &optional - is-local) - (elmo-folder-flag-as-important (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) - -(luna-define-method elmo-folder-unflag-important :around ((folder - elmo-filter-folder) - numbers - &optional - is-local) - (elmo-folder-unflag-important (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) - -(luna-define-method elmo-folder-flag-as-answered :around ((folder - elmo-filter-folder) - numbers - &optional - is-local) - (elmo-folder-flag-as-answered (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) - - -(luna-define-method elmo-folder-unflag-answered :around ((folder - elmo-filter-folder) - numbers - &optional - is-local) - (elmo-folder-unflag-answered (elmo-filter-folder-target-internal folder) - numbers is-local) - (luna-call-next-method)) +(luna-define-method elmo-folder-set-flag :before ((folder elmo-filter-folder) + numbers + flag + &optional is-local) + (elmo-folder-set-flag (elmo-filter-folder-target-internal folder) + numbers flag is-local)) + +(luna-define-method elmo-folder-unset-flag :before ((folder elmo-filter-folder) + numbers + flag + &optional is-local) + (elmo-folder-unset-flag (elmo-filter-folder-target-internal folder) + numbers flag is-local)) (require 'product) (product-provide (provide 'elmo-filter) (require 'elmo-version)) diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index c7ed570..50c2546 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -50,8 +50,12 @@ (setq name (match-string 1 name)) (setq name (symbol-name (car elmo-global-flag-list)))) (or (cdr (assq (intern name) elmo-global-flag-folder-alist)) - (let (msgdb-path) - (elmo-flag-folder-set-flag-internal folder (intern name)) + (let ((flag (intern name)) + msgdb-path) + (elmo-flag-folder-set-flag-internal folder flag) + (unless (elmo-global-flag-p flag) + (setq elmo-global-flag-list + (nconc elmo-global-flag-list (list flag)))) ;; must be AFTER set flag slot. (setq msgdb-path (elmo-folder-msgdb-path folder)) (unless (file-directory-p msgdb-path) @@ -180,6 +184,9 @@ src-folder number 'message-id))) + (elmo-folder-set-flag src-folder + numbers + (elmo-flag-folder-flag-internal folder)) numbers) (luna-define-method elmo-folder-append-buffer ((folder elmo-flag-folder) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index df99c67..60543c5 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -164,6 +164,11 @@ REGEXP should have a grouping for namespace prefix.") (defconst elmo-imap4-literal-threshold 1024 "Limitation of characters that can be used in a quoted string.") +(defconst elmo-imap4-flag-specs '((important "\\Flagged") + (read "\\Seen") + (unread "\\Seen" 'remove) + (answered "\\Answered"))) + ;; For debugging. (defvar elmo-imap4-debug nil "Non-nil forces IMAP4 folder as debug mode. @@ -1900,17 +1905,9 @@ Return nil if no complete line has arrived." (format "uid %d:*" (cdr (car killed))) "all")))) -(luna-define-method elmo-folder-list-unreads-plugged - ((folder elmo-imap4-folder)) - (elmo-imap4-folder-list-flagged folder 'unread)) - -(luna-define-method elmo-folder-list-importants-plugged - ((folder elmo-imap4-folder)) - (elmo-imap4-folder-list-flagged folder 'important)) - -(luna-define-method elmo-folder-list-answereds-plugged - ((folder elmo-imap4-folder)) - (elmo-imap4-folder-list-flagged folder 'answered)) +(luna-define-method elmo-folder-list-flagged-unplugged + ((folder elmo-imap4-folder) flag) + (elmo-imap4-folder-list-flagged folder flag)) (luna-define-method elmo-folder-use-flag-p ((folder elmo-imap4-folder)) (not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp @@ -2346,29 +2343,17 @@ If optional argument REMOVE is non-nil, remove FLAG." 'message-id))) elmo-imap4-current-msgdb)))) -(luna-define-method elmo-folder-unflag-important-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Flagged" 'remove)) - -(luna-define-method elmo-folder-flag-as-important-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Flagged")) - -(luna-define-method elmo-folder-unflag-read-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Seen" 'remove)) - -(luna-define-method elmo-folder-flag-as-read-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Seen")) - -(luna-define-method elmo-folder-unflag-answered-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Answered" 'remove)) - -(luna-define-method elmo-folder-flag-as-answered-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Answered")) +(luna-define-method elmo-folder-set-flag-plugged ((folder elmo-imap4-folder) + numbers flag) + (let ((spec (cdr (assq flag elmo-imap4-flag-specs)))) + (when spec + (elmo-imap4-set-flag folder numbers (car spec) (cdr spec))))) + +(luna-define-method elmo-folder-unset-flag-plugged ((folder elmo-imap4-folder) + numbers flag) + (let ((spec (cdr (assq flag elmo-imap4-flag-specs)))) + (when spec + (elmo-imap4-set-flag folder numbers (car spec) (not (cdr spec)))))) (luna-define-method elmo-message-use-cache-p ((folder elmo-imap4-folder) number) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index abaaf3c..6e3d05b 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -40,6 +40,11 @@ :type 'directory :group 'elmo) +(defconst elmo-maildir-flag-specs '((important ?F) + (read ?S) + (unread ?S 'remove) + (answered ?R))) + ;;; ELMO Maildir folder (eval-and-compile (luna-define-class elmo-maildir-folder @@ -126,17 +131,17 @@ LOCATION." (elmo-maildir-folder-set-answered-locations-internal folder (nth 3 locs)) (nth 0 locs))) -(luna-define-method elmo-map-folder-list-unreads - ((folder elmo-maildir-folder)) - (elmo-maildir-folder-unread-locations-internal folder)) - -(luna-define-method elmo-map-folder-list-importants - ((folder elmo-maildir-folder)) - (elmo-maildir-folder-flagged-locations-internal folder)) - -(luna-define-method elmo-map-folder-list-answereds - ((folder elmo-maildir-folder)) - (elmo-maildir-folder-answered-locations-internal folder)) +(luna-define-method elmo-map-folder-list-flagged ((folder elmo-maildir-folder) + flag) + (case flag + (unread + (elmo-maildir-folder-unread-locations-internal folder)) + (important + (elmo-maildir-folder-flagged-locations-internal folder)) + (answered + (elmo-maildir-folder-answered-locations-internal folder)) + (otherwise + t))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-maildir-folder) numbers flag-table) @@ -301,31 +306,22 @@ LOCATION." mark)) t) -(luna-define-method elmo-map-folder-flag-as-important ((folder elmo-maildir-folder) - locs) - (elmo-maildir-set-mark-msgs folder locs ?F)) - -(luna-define-method elmo-map-folder-unflag-important ((folder elmo-maildir-folder) - locs) - (elmo-maildir-delete-mark-msgs folder locs ?F)) - -(luna-define-method elmo-map-folder-flag-as-read ((folder elmo-maildir-folder) - locs) - (elmo-maildir-set-mark-msgs folder locs ?S)) - -(luna-define-method elmo-map-folder-unflag-read ((folder elmo-maildir-folder) - locs) - (elmo-maildir-delete-mark-msgs folder locs ?S)) - -(luna-define-method elmo-map-folder-flag-as-answered ((folder - elmo-maildir-folder) - locs) - (elmo-maildir-set-mark-msgs folder locs ?R)) - -(luna-define-method elmo-map-folder-unflag-answered ((folder - elmo-maildir-folder) - locs) - (elmo-maildir-delete-mark-msgs folder locs ?R)) +(defsubst elmo-maildir-set-mark-messages (folder locations mark remove) + (when mark + (if remove + (elmo-maildir-delete-mark-msgs folder locations mark) + (elmo-maildir-set-mark-msgs folder locations mark)))) + +(luna-define-method elmo-map-folder-set-flag ((folder elmo-maildir-folder) + locations flag) + (let ((spec (assq flag elmo-maildir-flag-specs))) + (elmo-maildir-set-mark-messages folder locations (car spec) (cdr spec)))) + +(luna-define-method elmo-map-folder-unset-flag ((folder elmo-maildir-folder) + locations flag) + (let ((spec (assq flag elmo-maildir-flag-specs))) + (elmo-maildir-set-mark-messages folder locations + (car spec) (not (cdr spec))))) (luna-define-method elmo-folder-list-subfolders ((folder elmo-maildir-folder) &optional one-level) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index 3dd3594..f61f73b 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -62,23 +62,11 @@ (luna-define-generic elmo-map-folder-list-message-locations (folder) "Return a location list of the FOLDER.") -(luna-define-generic elmo-map-folder-unflag-important (folder locations) - "") - -(luna-define-generic elmo-map-folder-flag-as-important (folder locations) - "") - -(luna-define-generic elmo-map-folder-unflag-read (folder locations) - "") +(luna-define-generic elmo-map-folder-set-flag (folder locations flag) + "Set FLAG to LOCATIONS.") -(luna-define-generic elmo-map-folder-flag-as-read (folder locations) - "") - -(luna-define-generic elmo-map-folder-unflag-answered (folder locations) - "") - -(luna-define-generic elmo-map-folder-flag-as-answered (folder locations) - "") +(luna-define-generic elmo-map-folder-unset-flag (folder locations flag) + "Unset FLAG from LOCATIONS.") (luna-define-generic elmo-map-message-fetch (folder location strategy @@ -87,24 +75,6 @@ unseen) "") -(luna-define-generic elmo-map-folder-list-unreads (folder) - "") - -(luna-define-method elmo-map-folder-list-unreads ((folder elmo-map-folder)) - t) - -(luna-define-generic elmo-map-folder-list-importants (folder) - "") - -(luna-define-method elmo-map-folder-list-importants ((folder elmo-map-folder)) - t) - -(luna-define-generic elmo-map-folder-list-answereds (folder) - "") - -(luna-define-method elmo-map-folder-list-answereds ((folder elmo-map-folder)) - t) - (luna-define-generic elmo-map-folder-delete-messages (folder locations) "") @@ -270,58 +240,25 @@ ((folder elmo-map-folder) &optional nohide) (mapcar 'car (elmo-map-folder-location-alist-internal folder))) -(luna-define-method elmo-folder-unflag-important :before ((folder - elmo-map-folder) - numbers - &optional - is-local) - (unless is-local - (elmo-map-folder-unflag-important - folder - (elmo-map-folder-numbers-to-locations folder numbers)))) - -(luna-define-method elmo-folder-flag-as-important :before ((folder - elmo-map-folder) - numbers - &optional - is-local) - (unless is-local - (elmo-map-folder-flag-as-important - folder - (elmo-map-folder-numbers-to-locations folder numbers)))) - -(luna-define-method elmo-folder-unflag-read :before ((folder elmo-map-folder) - numbers - &optional is-local) +(luna-define-method elmo-folder-set-flag :before ((folder elmo-map-folder) + numbers + flag + &optional is-local) (unless is-local - (elmo-map-folder-unflag-read + (elmo-map-folder-set-flag folder - (elmo-map-folder-numbers-to-locations folder numbers)))) + (elmo-map-folder-numbers-to-locations folder numbers) + flag))) -(luna-define-method elmo-folder-flag-as-read :before ((folder - elmo-map-folder) - numbers - &optional is-local) +(luna-define-method elmo-folder-unset-flag :before ((folder elmo-map-folder) + numbers + flag + &optional is-local) (unless is-local - (elmo-map-folder-flag-as-read + (elmo-map-folder-unset-flag folder - (elmo-map-folder-numbers-to-locations folder numbers)))) - -(luna-define-method elmo-folder-unflag-answered :before ((folder - elmo-map-folder) - numbers - &optional is-local) - (elmo-map-folder-unflag-answered - folder - (elmo-map-folder-numbers-to-locations folder numbers))) - -(luna-define-method elmo-folder-flag-as-answered :before ((folder - elmo-map-folder) - numbers - &optional is-local) - (elmo-map-folder-flag-as-answered - folder - (elmo-map-folder-numbers-to-locations folder numbers))) + (elmo-map-folder-numbers-to-locations folder numbers) + flag))) (luna-define-method elmo-message-fetch-internal ((folder elmo-map-folder) number strategy @@ -331,25 +268,20 @@ (elmo-map-message-location folder number) strategy section unread)) -(luna-define-method elmo-folder-list-unreads :around ((folder elmo-map-folder)) - (let ((locations (elmo-map-folder-list-unreads folder))) +(luna-define-method elmo-folder-list-flagged-internal ((folder elmo-map-folder) + flag) + (let ((locations (elmo-map-folder-list-flagged folder flag))) (if (listp locations) (elmo-map-folder-locations-to-numbers folder locations) - (luna-call-next-method)))) + t))) -(luna-define-method elmo-folder-list-importants :around ((folder - elmo-map-folder)) - (let ((locations (elmo-map-folder-list-importants folder))) - (if (listp locations) - (elmo-map-folder-locations-to-numbers folder locations) - (luna-call-next-method)))) +(luna-define-generic elmo-map-folder-list-flagged (folder flag) + "Return a list of message location in the FOLDER with FLAG. +Return t if the message list is not available.") -(luna-define-method elmo-folder-list-answereds :around ((folder - elmo-map-folder)) - (let ((locations (elmo-map-folder-list-answereds folder))) - (if (listp locations) - (elmo-map-folder-locations-to-numbers folder locations) - (luna-call-next-method)))) +(luna-define-method elmo-map-folder-list-flagged ((folder elmo-map-folder) + flag) + t) (luna-define-method elmo-folder-delete-messages ((folder elmo-map-folder) numbers) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index 8911469..7ef950f 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -268,51 +268,6 @@ (cons news alls) (list news unreads alls)))) -(luna-define-method elmo-folder-list-unreads ((folder elmo-multi-folder)) - (let ((cur-number 0) - unreads) - (dolist (child (elmo-multi-folder-children-internal folder)) - (setq cur-number (+ cur-number 1)) - (setq unreads - (nconc - unreads - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-unreads child))))) - unreads)) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-multi-folder)) - (let ((cur-number 0) - answereds) - (dolist (child (elmo-multi-folder-children-internal folder)) - (setq cur-number (+ cur-number 1)) - (setq answereds - (nconc - answereds - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-answereds child))))) - answereds)) - -(luna-define-method elmo-folder-list-importants ((folder elmo-multi-folder)) - (let ((cur-number 0) - importants) - (dolist (child (elmo-multi-folder-children-internal folder)) - (setq cur-number (+ cur-number 1)) - (setq importants - (nconc - importants - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-importants child))))) - importants)) - (luna-define-method elmo-folder-list-messages ((folder elmo-multi-folder) &optional visible-only in-msgdb) (let* ((flds (elmo-multi-folder-children-internal folder)) @@ -443,61 +398,19 @@ (setq msg-list (cdr msg-list))) ret-val)) -(luna-define-method elmo-folder-flag-as-important ((folder - elmo-multi-folder) - numbers - &optional - is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-flag-as-important (car folder-numbers) - (cdr folder-numbers) - is-local))) - -(luna-define-method elmo-folder-unflag-important ((folder - elmo-multi-folder) - numbers - &optional - is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-unflag-important (car folder-numbers) - (cdr folder-numbers) - is-local))) - -(luna-define-method elmo-folder-flag-as-read ((folder - elmo-multi-folder) - numbers - &optional is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-flag-as-read (car folder-numbers) - (cdr folder-numbers) - is-local))) - -(luna-define-method elmo-folder-unflag-read ((folder - elmo-multi-folder) - numbers - &optional is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-unflag-read (car folder-numbers) - (cdr folder-numbers) - is-local))) - -(luna-define-method elmo-folder-flag-as-answered ((folder - elmo-multi-folder) - numbers - &optional is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-flag-as-answered (car folder-numbers) - (cdr folder-numbers) - is-local))) - -(luna-define-method elmo-folder-unflag-answered ((folder - elmo-multi-folder) - numbers - &optional is-local) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-unflag-answered (car folder-numbers) - (cdr folder-numbers) - is-local))) +(luna-define-method elmo-folder-set-flag ((folder elmo-multi-folder) + numbers + flag + &optional is-local) + (dolist (pair (elmo-multi-make-folder-numbers-list folder numbers)) + (elmo-folder-set-flag (car pair) (cdr pair) flag is-local))) + +(luna-define-method elmo-folder-unset-flag ((folder elmo-multi-folder) + numbers + flag + &optional is-local) + (dolist (pair (elmo-multi-make-folder-numbers-list folder numbers)) + (elmo-folder-unset-flag (car pair) (cdr pair) flag is-local))) (luna-define-method elmo-folder-list-flagged ((folder elmo-multi-folder) flag diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index a479597..6d04129 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -402,37 +402,16 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-dop-spool-folder-list-messages folder)))) t)) -(luna-define-method elmo-folder-list-unreads :around ((folder - elmo-net-folder)) +(luna-define-method elmo-folder-list-flagged-internal ((folder elmo-net-folder) + flag) (if (and (elmo-folder-plugged-p folder) (elmo-folder-use-flag-p folder)) - (elmo-folder-send folder 'elmo-folder-list-unreads-plugged) - (luna-call-next-method))) - -(luna-define-method elmo-folder-list-importants :around ((folder - elmo-net-folder)) - (if (and (elmo-folder-plugged-p folder) - (elmo-folder-use-flag-p folder)) - (elmo-folder-send folder 'elmo-folder-list-importants-plugged) - (luna-call-next-method))) - -(luna-define-method elmo-folder-list-answereds :around ((folder - elmo-net-folder)) - (if (and (elmo-folder-plugged-p folder) - (elmo-folder-use-flag-p folder)) - (elmo-folder-send folder 'elmo-folder-list-answereds-plugged) - (luna-call-next-method))) - -(luna-define-method elmo-folder-list-unreads-plugged - ((folder elmo-net-folder)) - t) - -(luna-define-method elmo-folder-list-importants-plugged - ((folder elmo-net-folder)) - t) + (elmo-folder-send folder 'elmo-folder-list-flagged-plugged flag) + ;; Should consider offline append and removal? + t)) -(luna-define-method elmo-folder-list-answereds-plugged - ((folder elmo-net-folder)) +(luna-define-method elmo-folder-list-flagged-plugged ((folder elmo-net-folder) + flag) t) (luna-define-method elmo-folder-delete-messages ((folder elmo-net-folder) @@ -464,102 +443,39 @@ Returned value is searched from `elmo-network-stream-type-alist'." (mapcar 'abs numbers) flag-table))) -(luna-define-method elmo-folder-unflag-important :before ((folder - elmo-net-folder) - numbers - &optional - is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-unflag-important-plugged - numbers) - (elmo-folder-send folder - 'elmo-folder-unflag-important-unplugged numbers)))) - -(luna-define-method elmo-folder-flag-as-important :before ((folder - elmo-net-folder) - numbers - &optional - is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-flag-as-important-plugged - numbers) - (elmo-folder-send folder 'elmo-folder-flag-as-important-unplugged - numbers)))) - -(luna-define-method elmo-folder-unflag-read :before ((folder elmo-net-folder) - numbers - &optional is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-unflag-read-plugged numbers) - (elmo-folder-send folder 'elmo-folder-unflag-read-unplugged numbers)))) - -(luna-define-method elmo-folder-flag-as-read :before ((folder elmo-net-folder) - numbers - &optional is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-flag-as-read-plugged numbers) - (elmo-folder-send - folder 'elmo-folder-flag-as-read-unplugged numbers)))) - -(luna-define-method elmo-folder-unflag-answered :before ((folder - elmo-net-folder) - numbers - &optional is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-unflag-answered-plugged - numbers) - (elmo-folder-send folder - 'elmo-folder-unflag-answered-unplugged numbers)))) - -(luna-define-method elmo-folder-flag-as-answered :before ((folder - elmo-net-folder) - numbers - &optional is-local) - (when (and (elmo-folder-use-flag-p folder) - (not is-local)) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-flag-as-answered-plugged - numbers) - (elmo-folder-send folder 'elmo-folder-flag-as-answered-unplugged - numbers)))) - -(luna-define-method elmo-folder-flag-as-read-unplugged ((folder - elmo-net-folder) - numbers) - (elmo-folder-flag-as-read-dop folder numbers)) - -(luna-define-method elmo-folder-unflag-read-unplugged ((folder elmo-net-folder) - numbers) - (elmo-folder-unflag-read-dop folder numbers)) - -(luna-define-method elmo-folder-flag-as-important-unplugged ((folder - elmo-net-folder) - numbers) - (elmo-folder-flag-as-important-dop folder numbers)) - -(luna-define-method elmo-folder-unflag-important-unplugged ((folder - elmo-net-folder) - numbers) - (elmo-folder-unflag-important-dop folder numbers)) - -(luna-define-method elmo-folder-flag-as-answered-unplugged ((folder - elmo-net-folder) - numbers) - (elmo-folder-flag-as-answered-dop folder numbers)) - -(luna-define-method elmo-folder-unflag-answered-unplugged - ((folder elmo-net-folder) numbers) - (elmo-folder-unflag-answered-dop folder numbers)) +(luna-define-method elmo-folder-set-flag :before ((folder elmo-net-folder) + numbers + flag + &optional is-local) + (when (and (not is-local) + (elmo-folder-use-flag-p folder)) + (elmo-folder-send folder + (if (elmo-folder-plugged-p folder) + 'elmo-folder-set-flag-plugged + 'elmo-folder-set-flag-unplugged) + numbers + flag))) + +(luna-define-method elmo-folder-unset-flag :before ((folder elmo-net-folder) + numbers + flag + &optional is-local) + (when (and (not is-local) + (elmo-folder-use-flag-p folder)) + (elmo-folder-send folder + (if (elmo-folder-plugged-p folder) + 'elmo-folder-unset-flag-plugged + 'elmo-folder-unset-flag-unplugged) + numbers + flag))) + +(luna-define-method elmo-folder-set-flag-unplugged ((folder elmo-net-folder) + numbers flag) + (elmo-folder-set-flag-dop folder numbers flag)) + +(luna-define-method elmo-folder-unset-flag-unplugged ((folder elmo-net-folder) + numbers flag) + (elmo-folder-unset-flag-dop folder numbers flag)) (luna-define-method elmo-message-encache :around ((folder elmo-net-folder) number &optional read) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 1df515a..fff7b48 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -1506,11 +1506,19 @@ Returns a list of cons cells like (NUMBER . VALUE)" folder (delq elem (elmo-nntp-folder-temp-crosses-internal folder))))))) -(luna-define-method elmo-folder-flag-as-read :before ((folder - elmo-nntp-folder) - numbers - &optional is-local) - (elmo-nntp-folder-update-crosspost-message-alist folder numbers)) +(luna-define-method elmo-folder-set-flag :before ((folder elmo-nntp-folder) + numbers + flag + &optional is-local) + (when (eq flag 'read) + (elmo-nntp-folder-update-crosspost-message-alist folder numbers))) + +(luna-define-method elmo-folder-unset-flag :before ((folder elmo-nntp-folder) + numbers + flag + &optional is-local) + (when (eq flag 'unread) + (elmo-nntp-folder-update-crosspost-message-alist folder numbers))) (defsubst elmo-nntp-folder-process-crosspost (folder) ;; 2.1. At elmo-folder-process-crosspost, setup `reads' slot from @@ -1536,12 +1544,17 @@ Returns a list of cons cells like (NUMBER . VALUE)" (luna-define-method elmo-folder-process-crosspost ((folder elmo-nntp-folder)) (elmo-nntp-folder-process-crosspost folder)) -(luna-define-method elmo-folder-list-unreads :around ((folder - elmo-nntp-folder)) +(luna-define-method elmo-folder-list-flagged :around ((folder elmo-nntp-folder) + flag) ;; 2.3. elmo-folder-list-unreads return unread message list according to ;; `reads' slot. - (elmo-living-messages (luna-call-next-method) - (elmo-nntp-folder-reads-internal folder))) + (case flag + (unread + (elmo-living-messages (luna-call-next-method) + (elmo-nntp-folder-reads-internal folder))) + ;; Should consider read, digest and any flag? + (otherwise + (luna-call-next-method)))) (require 'product) (product-provide (provide 'elmo-nntp) (require 'elmo-version)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index fe6239e..9409c88 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -162,15 +162,6 @@ (elmo-folder-list-messages (elmo-pipe-folder-dst-internal folder) visible-only in-msgdb)) -(luna-define-method elmo-folder-list-unreads ((folder elmo-pipe-folder)) - (elmo-folder-list-unreads (elmo-pipe-folder-dst-internal folder))) - -(luna-define-method elmo-folder-list-importants ((folder elmo-pipe-folder)) - (elmo-folder-list-importants (elmo-pipe-folder-dst-internal folder))) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-pipe-folder)) - (elmo-folder-list-answereds (elmo-pipe-folder-dst-internal folder))) - (luna-define-method elmo-folder-diff ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-src-internal folder)) (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder)) @@ -268,40 +259,19 @@ (elmo-folder-message-make-temp-files (elmo-pipe-folder-dst-internal folder) numbers start-number)) -(luna-define-method elmo-folder-flag-as-read ((folder elmo-pipe-folder) - numbers &optional is-local) - (elmo-folder-flag-as-read (elmo-pipe-folder-dst-internal folder) - numbers is-local)) - -(luna-define-method elmo-folder-unflag-read ((folder elmo-pipe-folder) - numbers - &optional is-local) - (elmo-folder-unflag-read (elmo-pipe-folder-dst-internal folder) - numbers is-local)) - -(luna-define-method elmo-folder-unflag-important ((folder elmo-pipe-folder) - numbers - &optional is-local) - (elmo-folder-unflag-important (elmo-pipe-folder-dst-internal folder) - numbers is-local)) - -(luna-define-method elmo-folder-flag-as-important ((folder elmo-pipe-folder) - numbers - &optional is-local) - (elmo-folder-flag-as-important (elmo-pipe-folder-dst-internal folder) - numbers is-local)) - -(luna-define-method elmo-folder-unflag-answered ((folder elmo-pipe-folder) - numbers - &optional is-local) - (elmo-folder-unflag-answered (elmo-pipe-folder-dst-internal folder) - numbers is-local)) - -(luna-define-method elmo-folder-flag-as-answered ((folder elmo-pipe-folder) - numbers - &optional is-local) - (elmo-folder-flag-as-answered (elmo-pipe-folder-dst-internal folder) - numbers is-local)) +(luna-define-method elmo-folder-set-flag ((folder elmo-pipe-folder) + numbers + flag + &optional is-local) + (elmo-folder-set-flag (elmo-pipe-folder-dst-internal folder) + numbers flag is-local)) + +(luna-define-method elmo-folder-unset-flag ((folder elmo-pipe-folder) + numbers + flag + &optional is-local) + (elmo-folder-unset-flag (elmo-pipe-folder-dst-internal folder) + numbers flag is-local)) (luna-define-method elmo-folder-pack-numbers ((folder elmo-pipe-folder)) (elmo-folder-pack-numbers (elmo-pipe-folder-dst-internal folder))) diff --git a/elmo/elmo.el b/elmo/elmo.el index 7a845e0..87c867c 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -87,7 +87,8 @@ Otherwise, entire fetching of the message is aborted without confirmation." (autoload 'elmo-global-flag-detach "elmo-flag") (autoload 'elmo-global-flag-detach-messages "elmo-flag") (autoload 'elmo-global-flag-set "elmo-flag") - (autoload 'elmo-global-mark-migrate "elmo-flag")) + (autoload 'elmo-global-mark-migrate "elmo-flag") + (autoload 'elmo-folder-list-global-flag-messages "elmo-flag")) (defun elmo-define-folder (prefix backend) "Define a folder. @@ -236,12 +237,11 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed.") #'delq) list)))) -(luna-define-generic elmo-folder-list-unreads (folder) - "Return a list of unread message numbers contained in FOLDER.") -(luna-define-generic elmo-folder-list-importants (folder) - "Return a list of important message numbers contained in FOLDER.") -(luna-define-generic elmo-folder-list-answereds (folder) - "Return a list of answered message numbers contained in FOLDER.") +(luna-define-generic elmo-folder-list-messages-internal (folder &optional + visible-only) + ;; Return a list of message numbers contained in FOLDER. + ;; Return t if the message list is not available. + ) (luna-define-generic elmo-folder-list-flagged (folder flag &optional in-msgdb) "List messages in the FOLDER with FLAG. @@ -259,23 +259,24 @@ If optional IN-MSGDB is non-nil, retrieve flag information from msgdb.") (luna-define-method elmo-folder-list-flagged ((folder elmo-folder) flag &optional in-msgdb) - ;; Currently, only in-msgdb is implemented. - (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag)) - -(luna-define-method elmo-folder-list-unreads ((folder elmo-folder)) - (elmo-folder-list-flagged folder 'unread)) - -(luna-define-method elmo-folder-list-importants ((folder elmo-folder)) - (elmo-folder-list-flagged folder 'important)) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-folder)) - (elmo-folder-list-flagged folder 'answered)) - -(luna-define-generic elmo-folder-list-messages-internal (folder &optional - visible-only) - ;; Return a list of message numbers contained in FOLDER. - ;; Return t if the message list is not available. - ) + (let ((msgs (if in-msgdb + t + (elmo-folder-list-flagged-internal folder flag)))) + (unless (listp msgs) + (setq msgs (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag))) + (if in-msgdb + msgs + (elmo-uniq-list + (nconc (elmo-folder-list-global-flag-messages folder flag) msgs) + #'delq)))) + +(luna-define-generic elmo-folder-list-flagged-internal (folder flag) + "Return a list of message in the FOLDER with FLAG. +Return t if the message list is not available.") + +(luna-define-method elmo-folder-list-flagged-internal ((folder elmo-folder) + flag) + t) (luna-define-generic elmo-folder-list-subfolders (folder &optional one-level) "Returns a list of subfolders contained in FOLDER. @@ -338,47 +339,33 @@ FOLDER is the ELMO folder structure. NUMBERS is a list of message numbers to create msgdb. FLAG-TABLE is a hashtable of message-id and flag.") -(luna-define-generic elmo-folder-unflag-important (folder - numbers - &optional is-local) - "Un-flag messages as important. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed. -If IS-LOCAL is non-nil, only the local flag is updated.") - -(luna-define-generic elmo-folder-flag-as-important (folder - numbers - &optional is-local) - "Flag messages as important. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed. -If IS-LOCAL is non-nil, only the local flag is updated.") - -(luna-define-generic elmo-folder-unflag-read (folder numbers - &optional is-local) - "Un-flag messages as read. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed. -If IS-LOCAL is non-nil, only the local flag is updated.") +(luna-define-generic elmo-folder-set-flag (folder numbers flag + &optional is-local) + "Set messages flag. +FOLDER is a ELMO folder structure. +NUMBERS is a list of message number to set flag. -(luna-define-generic elmo-folder-flag-as-read (folder numbers - &optional is-local) - "Flag messages as read. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed. -If IS-LOCAL is non-nil, only the local flag is updated.") +FLAG is a symbol which is one of the following: + `unread' (set the message as unread) + `answered' (set the message as answered) + `important' (set the message as important) +'sugar' flag: + `read' (remove new and unread flags) +If optional IS-LOCAL is non-nil, update only local (not server) status.") -(luna-define-generic elmo-folder-unflag-answered (folder numbers - &optional is-local) - "Un-flag messages as answered. -FOLDER is the ELMO folder structure. -If IS-LOCAL is non-nil, only the local flag is updated.") +(luna-define-generic elmo-folder-unset-flag (folder numbers flag + &optional is-local) + "Unset messages flag. +FOLDER is a ELMO folder structure. +NUMBERS is a list of message number to unset flag. -(luna-define-generic elmo-folder-flag-as-answered (folder numbers - &optional is-local) - "Flag messages as answered. -FOLDER is the ELMO folder structure. -If IS-LOCAL is non-nil, only the local flag is updated.") +FLAG is a symbol which is one of the following: + `unread' (remove unread and new flag) + `answered' (remove answered flag) + `important' (remove important flag) +'sugar' flag: + `read' (set unread flag) +If optional IS-LOCAL is non-nil, update only local (not server) status.") (luna-define-generic elmo-folder-next-message-number (folder) "The next message number that will be assigned to a new message. @@ -1162,15 +1149,7 @@ FLAG is a symbol which is one of the following: `read' (remove new and unread flags) If optional IS-LOCAL is non-nil, update only local (not server) status." ;; XXX Transitional implementation. - (case flag - (unread - (elmo-folder-unflag-read folder (list number) is-local)) - (read - (elmo-folder-flag-as-read folder (list number) is-local)) - (answered - (elmo-folder-flag-as-answered folder (list number) is-local)) - (important - (elmo-folder-flag-as-important folder (list number) is-local)))) + (elmo-folder-set-flag folder (list number) flag is-local)) (defun elmo-message-unset-flag (folder number flag &optional is-local) "Unset message flag. @@ -1185,15 +1164,7 @@ FLAG is a symbol which is one of the following: `read' (set unread flag) If optional IS-LOCAL is non-nil, update only local (not server) status." ;; XXX Transitional implementation. - (case flag - (unread - (elmo-folder-flag-as-read folder (list number) is-local)) - (read - (elmo-folder-unflag-read folder (list number) is-local)) - (answered - (elmo-folder-unflag-answered folder (list number) is-local)) - (important - (elmo-folder-unflag-important folder (list number) is-local)))) + (elmo-folder-unset-flag folder (list number) flag is-local)) (luna-define-generic elmo-message-field (folder number field) "Get message field value in the msgdb. @@ -1210,70 +1181,30 @@ FIELD is a symbol of the field.") (luna-define-method elmo-message-folder ((folder elmo-folder) number) folder) ; default is folder -(luna-define-method elmo-folder-unflag-important ((folder elmo-folder) - numbers - &optional is-local) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (when (elmo-global-flag-p 'important) - (elmo-global-flag-detach 'important folder number 'always)) - (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) - number - 'important)))) - -(luna-define-method elmo-folder-flag-as-important ((folder elmo-folder) - numbers - &optional is-local) - (let (path message-id) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - ;; important message should always be a read message. - (if (eq (elmo-file-cache-exists-p - (setq message-id - (elmo-message-field folder number 'message-id))) - 'entire) - (elmo-folder-flag-as-read folder (list number))) - (when (elmo-global-flag-p 'important) - (elmo-global-flag-set 'important folder number message-id)) - (elmo-msgdb-set-flag (elmo-folder-msgdb folder) - number - 'important))))) - -(luna-define-method elmo-folder-unflag-read ((folder elmo-folder) - numbers - &optional is-local) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) - number - 'read)))) - -(luna-define-method elmo-folder-flag-as-read ((folder elmo-folder) - numbers - &optional is-local) +(luna-define-method elmo-folder-set-flag ((folder elmo-folder) + numbers + flag + &optional is-local) (when (elmo-folder-msgdb-internal folder) (dolist (number numbers) + (when (elmo-global-flag-p flag) + (let ((message-id (elmo-message-field folder number 'message-id))) + (elmo-global-flag-set flag folder number message-id))) (elmo-msgdb-set-flag (elmo-folder-msgdb folder) number - 'read)))) + flag)))) -(luna-define-method elmo-folder-unflag-answered ((folder elmo-folder) - numbers - &optional is-local) +(luna-define-method elmo-folder-unset-flag ((folder elmo-folder) + numbers + flag + &optional is-local) (when (elmo-folder-msgdb-internal folder) (dolist (number numbers) + (when (elmo-global-flag-p flag) + (elmo-global-flag-detach flag folder number 'always)) (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number - 'answered)))) - -(luna-define-method elmo-folder-flag-as-answered ((folder elmo-folder) - numbers - &optional is-local) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-set-flag (elmo-folder-msgdb folder) - number - 'answered)))) + flag)))) (luna-define-method elmo-folder-process-crosspost ((folder elmo-folder)) ;; Do nothing. @@ -1301,11 +1232,11 @@ FIELD is a symbol of the field.") ;; Let duplicates be a temporary killed message. (elmo-folder-kill-messages folder duplicates) ;; Should be flag as read. - (elmo-folder-flag-as-read folder duplicates)) + (elmo-folder-set-flag folder duplicates 'read)) ((eq (elmo-folder-process-duplicates-internal folder) 'read) ;; Flag as read duplicates. - (elmo-folder-flag-as-read folder duplicates)) + (elmo-folder-set-flag folder duplicates 'read)) (t ;; Do nothing. (setq duplicates nil))) diff --git a/wl/ChangeLog b/wl/ChangeLog index 965e12e..7e77fa1 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,16 @@ 2004-01-11 Hiroya Murata + * wl-summary.el (wl-summary-mark-as-read-all): Follow the API + change. + (wl-summary-sync-marks): Ditto. + (wl-summary-mark-as-read-internal): Ditto. + (wl-summary-mark-as-answered-internal): Ditto. + (wl-summary-mark-as-important-internal): Ditto. + (wl-summary-reply): Ditto. + + * wl-draft.el (wl-draft-kill): Use `elmo-folder-unset-flag' + instead of `elmo-folder-unflag-answered'. + * Version number is increased to 2.11.23. * wl-spam.el (wl-summary-exec-action-refile-with-register): Fixed diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 85fcdf9..98201e1 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -772,11 +772,11 @@ Reply to author if WITH-ARG is non-nil." (string= (wl-summary-buffer-folder-name) folder-name))) (with-current-buffer buffer - (elmo-folder-unflag-answered folder (list number)) + (elmo-folder-unset-flag folder (list number) 'answered) (when (wl-summary-jump-to-msg number) (wl-summary-update-persistent-mark))) (elmo-folder-open folder 'load-msgdb) - (elmo-folder-unflag-answered folder (list number)) + (elmo-folder-unset-flag folder (list number) 'answered) (elmo-folder-close folder)))) (wl-draft-hide cur-buf) (wl-draft-delete cur-buf))) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index e2ab55f..4a07aac 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1618,9 +1618,10 @@ If ARG is non-nil, checking is omitted." (let ((folder wl-summary-buffer-elmo-folder) (cur-buf (current-buffer))) (message "Setting all msgs as read...") - (elmo-folder-flag-as-read folder - (elmo-folder-list-unreads - folder)) + (elmo-folder-set-flag + folder + (elmo-folder-list-flagged folder 'unread 'in-msgdb) + 'read) (save-excursion (goto-char (point-min)) (while (not (eobp)) @@ -1752,30 +1753,15 @@ This function is defined for `window-scroll-functions'" (defun wl-summary-sync-marks () "Update persistent marks in summary." (interactive) - (let ((last-progress 0) - (folder wl-summary-buffer-elmo-folder) - (i 0) - answereds importants unreads diff diffs - mes progress) + (let (diff diffs mes) ;; synchronize marks. (when (not (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder) 'internal)) (message "Updating marks...") - (setq importants (elmo-uniq-list - (nconc (elmo-folder-list-importants - wl-summary-buffer-elmo-folder) - ;; XXX Temporal implementation. - ;; It should be merged to the - ;; elmo-folder-list-flagged. - (elmo-folder-list-global-flag-messages - wl-summary-buffer-elmo-folder - 'important))) - unreads (elmo-folder-list-unreads - wl-summary-buffer-elmo-folder) - answereds (elmo-folder-list-answereds - wl-summary-buffer-elmo-folder)) - (setq diff (elmo-list-diff importants + (setq diff (elmo-list-diff (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'important) (elmo-folder-list-flagged wl-summary-buffer-elmo-folder 'important 'in-msgdb))) @@ -1790,7 +1776,9 @@ This function is defined for `window-scroll-functions'" (wl-summary-mark-as-important (car diffs) 'no-server) (setq diffs (cdr diffs))) - (setq diff (elmo-list-diff answereds + (setq diff (elmo-list-diff (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'answered) (elmo-folder-list-flagged wl-summary-buffer-elmo-folder 'answered 'in-msgdb))) @@ -1805,7 +1793,9 @@ This function is defined for `window-scroll-functions'" (wl-summary-mark-as-answered (car diffs) 'no-modeline) (setq diffs (cdr diffs))) - (setq diff (elmo-list-diff unreads + (setq diff (elmo-list-diff (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'unread) (elmo-folder-list-flagged wl-summary-buffer-elmo-folder 'unread 'in-msgdb))) @@ -2977,8 +2967,8 @@ Return non-nil if the mark is updated" (if (null number-list) (message "No message.") (if inverse - (elmo-folder-unflag-read folder number-list no-folder-mark) - (elmo-folder-flag-as-read folder number-list no-folder-mark)) + (elmo-folder-unset-flag folder number-list 'read no-folder-mark) + (elmo-folder-set-flag folder number-list 'read no-folder-mark)) (dolist (number number-list) (setq visible (wl-summary-jump-to-msg number)) (unless inverse @@ -2989,7 +2979,6 @@ Return non-nil if the mark is updated" (wl-summary-update-persistent-mark))) (unless no-modeline-update ;; Update unread numbers. - ;; should elmo-folder-flag-as-read return unread numbers? (wl-summary-count-unread) (wl-summary-update-modeline) (wl-folder-update-unread @@ -3033,8 +3022,8 @@ Return non-nil if the mark is updated" (if (null number-list) (message "No message.") (if inverse - (elmo-folder-unflag-answered folder number-list) - (elmo-folder-flag-as-answered folder number-list)) + (elmo-folder-unset-flag folder number-list 'answered) + (elmo-folder-set-flag folder number-list 'answered)) (dolist (number number-list) (setq visible (wl-summary-jump-to-msg number)) ;; set mark on buffer @@ -3088,8 +3077,10 @@ Return non-nil if the mark is updated" (if (null number-list) (message "No message.") (if inverse - (elmo-folder-unflag-important folder number-list no-server-update) - (elmo-folder-flag-as-important folder number-list no-server-update)) + (elmo-folder-unset-flag folder number-list + 'important no-server-update) + (elmo-folder-set-flag folder number-list + 'important no-server-update)) (dolist (number number-list) (setq visible (wl-summary-jump-to-msg number)) ;; set mark on buffer @@ -3927,7 +3918,7 @@ Reply to author if invoked with ARG." (error (set-window-configuration winconf) (signal (car err)(cdr err)))) (with-current-buffer summary-buf - (elmo-folder-flag-as-answered folder (list number)) + (elmo-folder-set-flag folder (list number) 'answered) (wl-summary-update-persistent-mark)) t)))