X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=elmo%2Felmo-dop.el;h=0286fc0a3681eb2072fc6a9bd33d55e570625bcc;hb=c2738fdc4e616fb55973a7e285432f60af6c1c57;hp=bbacd0aa644617163000a8aa4d3d2d685a241064;hpb=3e35bd5d7e240cc009ae59e6e5c3230352d73900;p=elisp%2Fwanderlust.git diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index bbacd0a..0286fc0 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -63,24 +63,24 @@ Automatically loaded/saved.") (setq elmo-dop-queue (nconc elmo-dop-queue (list queue))))) (defvar elmo-dop-queue-merge-method-list - '(elmo-folder-mark-as-read - elmo-folder-unmark-read - elmo-folder-mark-as-important - elmo-folder-unmark-important - elmo-folder-mark-as-answered - elmo-folder-unmark-answered)) + '(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)) (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-mark-as-read . "Read") - (elmo-folder-unmark-read . "Unread") - (elmo-folder-mark-as-answered . "Answered") - (elmo-folder-unmark-answered . "Unanswered") - (elmo-folder-mark-as-important . "Important") - (elmo-folder-unmark-important . "Unimportant"))) + (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"))) (defmacro elmo-dop-queue-method-name (queue) `(cdr (assq (elmo-dop-queue-method ,queue) @@ -266,42 +266,46 @@ 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-mark-as-read-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-mark-as-read (list numbers))) +(defsubst elmo-folder-flag-as-read-dop (folder numbers) + (elmo-dop-queue-append folder 'elmo-folder-flag-as-read (list numbers))) -(defsubst elmo-folder-unmark-read-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unmark-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-mark-as-important-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-mark-as-important (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-unmark-important-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unmark-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-mark-as-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-mark-as-answered (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-unmark-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unmark-answered (list numbers))) +(defsubst elmo-folder-unflag-answered-dop (folder numbers) + (elmo-dop-queue-append folder 'elmo-folder-unflag-answered (list numbers))) ;;; Execute as subsutitute for plugged operation. (defun elmo-folder-status-dop (folder) - (let ((number-list (elmo-msgdb-list-messages - (elmo-folder-msgdb-path folder))) + (let ((number-list (sort (elmo-folder-list-messages folder nil 'in-msgdb) '>)) (spool-folder (elmo-dop-spool-folder folder)) spool-length - (i 0) max-num) - (setq spool-length (or (car (if (elmo-folder-exists-p spool-folder) - (elmo-folder-status spool-folder))) 0)) - (setq max-num - (or (nth (max (- (length number-list) 1) 0) number-list) - 0)) + (setq spool-length (or (if (elmo-folder-exists-p spool-folder) + (car (elmo-folder-status spool-folder))) + 0)) + (setq max-num (or (car number-list) 0)) (cons (+ max-num spool-length) (+ (length number-list) spool-length)))) ;;; Delayed operation (executed at online status). (defun elmo-folder-append-buffer-dop-delayed (folder flag number set-number) (let ((spool-folder (elmo-dop-spool-folder folder)) + (flags (cond ((listp flag) + flag) + ;; for compatibility + ((eq flag t) + nil) + (t + (list flag)))) failure saved dequeued) (with-temp-buffer (if (elmo-message-fetch spool-folder number @@ -311,7 +315,7 @@ FOLDER is the folder structure." (setq failure (not (elmo-folder-append-buffer folder - (if (eq flag t) nil flag) ; for compatibility + flags set-number))) (error (setq failure t))) (setq dequeued t)) ; Already deletef from queue. @@ -319,7 +323,7 @@ FOLDER is the folder structure." ;; Append failed... (setq saved (elmo-folder-append-buffer (elmo-make-folder elmo-lost+found-folder) - (if (eq flag t) nil flag) ; for compatibility + flags set-number))) (if (and (not dequeued) ; if dequeued, no need to delete. (or (not failure) ; succeed