From 2a411790da5e15af74e1b82857c221cea02059f7 Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 12 Dec 2002 00:39:33 +0000 Subject: [PATCH] Synch up with main trunk. --- elmo/elmo-archive.el | 48 +++---- elmo/elmo-cache.el | 29 +--- elmo/elmo-dop.el | 12 +- elmo/elmo-filter.el | 209 +++++++++++++++-------------- elmo/elmo-imap4.el | 48 ++++--- elmo/elmo-localdir.el | 10 +- elmo/elmo-maildir.el | 9 +- elmo/elmo-map.el | 22 +-- elmo/elmo-mark.el | 17 +-- elmo/elmo-msgdb.el | 242 ++++++++++++++++++++++++++++----- elmo/elmo-multi.el | 163 +++++++++++----------- elmo/elmo-net.el | 77 +++++++---- elmo/elmo-nmz.el | 26 +--- elmo/elmo-nntp.el | 65 +++------ elmo/elmo-pipe.el | 24 ++-- elmo/elmo-pop3.el | 20 +-- elmo/elmo-sendlog.el | 29 +--- elmo/elmo-shimbun.el | 32 +---- elmo/elmo-util.el | 2 +- elmo/elmo.el | 351 +++++++++++++++++++++++++++--------------------- wl/wl-expire.el | 4 +- wl/wl-folder.el | 15 ++- wl/wl-highlight.el | 40 +++--- wl/wl-summary.el | 358 +++++++++++++++++++++++++------------------------ wl/wl-thread.el | 16 +-- wl/wl-vars.el | 46 ++----- 26 files changed, 1010 insertions(+), 904 deletions(-) diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 5d86809..06fb518 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -607,8 +607,7 @@ TYPE specifies the archiver's symbol." nil)))))) (luna-define-method elmo-folder-append-messages :around - ((folder elmo-archive-folder) src-folder numbers unread-marks - &optional same-number) + ((folder elmo-archive-folder) src-folder numbers &optional same-number) (let ((prefix (elmo-archive-folder-archive-prefix-internal folder))) (cond ((and same-number @@ -901,9 +900,7 @@ TYPE specifies the archiver's symbol." (elmo-archive-msgdb-create-entity-subr number)))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-archive-folder) - numbers new-mark - already-mark seen-mark - important-mark seen-list) + numbers seen-list) (when numbers (save-excursion ;; 981005 (if (and elmo-archive-use-izip-agent @@ -911,17 +908,11 @@ TYPE specifies the archiver's symbol." (elmo-archive-folder-archive-type-internal folder) 'cat-headers)) (elmo-archive-msgdb-create-as-numlist-subr2 - folder numbers new-mark already-mark seen-mark important-mark - seen-list) + folder numbers seen-list) (elmo-archive-msgdb-create-as-numlist-subr1 - folder numbers new-mark already-mark seen-mark important-mark - seen-list))))) + folder numbers seen-list))))) -(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder - numlist new-mark - already-mark seen-mark - important-mark - seen-list) +(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist seen-list) (let* ((type (elmo-archive-folder-archive-type-internal folder)) (file (elmo-archive-get-archive-name folder)) (method (elmo-archive-get-method type 'cat)) @@ -954,10 +945,10 @@ TYPE specifies the archiver's symbol." (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen - seen-mark - new-mark)))) + elmo-msgdb-read-uncached-mark + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -975,9 +966,7 @@ TYPE specifies the archiver's symbol." ;;; info-zip agent (defun elmo-archive-msgdb-create-as-numlist-subr2 (folder - numlist new-mark - already-mark seen-mark - important-mark + numlist seen-list) (let* ((delim1 elmo-mmdf-delimiter) ;; MMDF (delim2 elmo-unixmail-delimiter) ;; UNIX Mail @@ -1011,10 +1000,7 @@ TYPE specifies the archiver's symbol." (goto-char (point-min)) (cond ((looking-at delim1) ;; MMDF - (setq result (elmo-archive-parse-mmdf msgs - new-mark - already-mark seen-mark - seen-list)) + (setq result (elmo-archive-parse-mmdf msgs seen-list)) (setq overview (append overview (nth 0 result))) (setq number-alist (append number-alist (nth 1 result))) (setq mark-alist (append mark-alist (nth 2 result)))) @@ -1033,10 +1019,7 @@ TYPE specifies the archiver's symbol." percent)))) (list overview number-alist mark-alist))) -(defun elmo-archive-parse-mmdf (msgs new-mark - already-mark - seen-mark - seen-list) +(defun elmo-archive-parse-mmdf (msgs seen-list) (let ((delim elmo-mmdf-delimiter) number sp ep rest entity overview number-alist mark-alist ret-val message-id seen gmark) @@ -1069,16 +1052,17 @@ TYPE specifies the archiver's symbol." (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen - seen-mark - new-mark)))) + elmo-msgdb-read-uncached-mark + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark))) - (setq ret-val (append ret-val (list overview number-alist mark-alist))) + (setq ret-val (append ret-val (list overview number-alist + mark-alist))) (widen))) (forward-line 1) (setq rest (cdr rest))) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 67d80b7..5efac75 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -87,10 +87,7 @@ (elmo-cache-folder-directory-internal folder))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-cache-folder) - numbers new-mark - already-mark seen-mark - important-mark - seen-list) + numbers seen-list) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -112,7 +109,8 @@ num message-id)) (if (setq mark (or (elmo-msgdb-global-mark-get message-id) - (if (member message-id seen-list) nil new-mark))) + (if (member message-id seen-list) nil + elmo-msgdb-new-mark))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -170,27 +168,6 @@ (luna-define-method elmo-message-file-p ((folder elmo-cache-folder) number) t) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-cache-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-cache-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-cache-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-cache-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-cache-folder) - numbers) - t) - (require 'product) (product-provide (provide 'elmo-cache) (require 'elmo-version)) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 2ea9ebd..b826d07 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -66,7 +66,9 @@ Automatically loaded/saved.") '(elmo-folder-mark-as-read elmo-folder-unmark-read elmo-folder-mark-as-important - elmo-folder-unmark-important)) + elmo-folder-unmark-important + elmo-folder-mark-as-answered + elmo-folder-unmark-answered)) (defvar elmo-dop-queue-method-name-alist '((elmo-folder-append-buffer-dop-delayed . "Append") @@ -75,6 +77,8 @@ Automatically loaded/saved.") (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"))) @@ -274,6 +278,12 @@ FOLDER is the folder structure." (defsubst elmo-folder-unmark-important-dop (folder numbers) (elmo-dop-queue-append folder 'elmo-folder-unmark-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-unmark-answered-dop (folder numbers) + (elmo-dop-queue-append folder 'elmo-folder-unmark-answered (list numbers))) + ;;; Execute as subsutitute for plugged operation. (defun elmo-folder-status-dop (folder) (let* ((number-alist (elmo-msgdb-number-load diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 11b4cbd..7852793 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -33,7 +33,7 @@ ;;; ELMO filter folder (eval-and-compile (luna-define-class elmo-filter-folder (elmo-folder) - (condition target)) + (condition target require-msgdb)) (luna-define-internal-accessors 'elmo-filter-folder)) (luna-define-method elmo-folder-initialize ((folder elmo-filter-folder) @@ -47,17 +47,41 @@ folder (elmo-make-folder (elmo-match-string 1 (cdr pair)))) (error "Folder syntax error `%s'" (elmo-folder-name-internal folder))) + (elmo-filter-folder-set-require-msgdb-internal + folder + (elmo-folder-search-requires-msgdb-p + (elmo-filter-folder-target-internal folder) + (elmo-filter-folder-condition-internal folder))) folder)) -(luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder)) - (elmo-folder-open-internal (elmo-filter-folder-target-internal folder))) +;(luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder)) +; (elmo-folder-open-internal (elmo-filter-folder-target-internal folder))) + +(luna-define-method elmo-folder-msgdb :around ((folder elmo-filter-folder)) + ;; Load target's msgdb if required. + (if (elmo-filter-folder-require-msgdb-internal folder) + (elmo-folder-msgdb (elmo-filter-folder-target-internal folder))) + ;; Load msgdb of itself. + (luna-call-next-method)) (luna-define-method elmo-folder-check ((folder elmo-filter-folder)) - (elmo-folder-check (elmo-filter-folder-target-internal folder))) + (elmo-folder-synchronize (elmo-filter-folder-target-internal folder))) (luna-define-method elmo-folder-close-internal ((folder elmo-filter-folder)) (elmo-folder-close-internal (elmo-filter-folder-target-internal folder))) +(luna-define-method elmo-folder-close :around ((folder elmo-filter-folder)) + ;; Save target msgdb if it is used. + (if (elmo-filter-folder-require-msgdb-internal folder) + (elmo-folder-close (elmo-filter-folder-target-internal folder))) + (luna-call-next-method)) + +(luna-define-method elmo-folder-commit :around ((folder elmo-filter-folder)) + ;; Save target msgdb if it is used. + (if (elmo-filter-folder-require-msgdb-internal folder) + (elmo-folder-commit (elmo-filter-folder-target-internal folder))) + (luna-call-next-method)) + (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-filter-folder)) (expand-file-name @@ -84,51 +108,30 @@ type)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-filter-folder) - numlist new-mark already-mark - seen-mark important-mark - seen-list) - (let ((target-folder (elmo-filter-folder-target-internal folder))) - (if (elmo-folder-plugged-p target-folder) - (elmo-folder-msgdb-create target-folder - numlist - new-mark - already-mark - seen-mark important-mark seen-list) - ;; Copy from msgdb of target folder if it is unplugged. - (let ((len (length numlist)) - (msgdb (elmo-folder-msgdb target-folder)) - overview number-alist mark-alist - message-id seen gmark) - (when (> len elmo-display-progress-threshold) - (elmo-progress-set 'elmo-folder-msgdb-create - len "Creating msgdb...")) - (unwind-protect - (dolist (number numlist) - (let ((entity (elmo-msgdb-overview-get-entity number msgdb))) - (when entity - (setq entity (elmo-msgdb-copy-overview-entity entity) - overview (elmo-msgdb-append-element overview entity) - message-id (elmo-msgdb-overview-entity-get-id entity) - number-alist (elmo-msgdb-number-add number-alist - number - message-id) - seen (member message-id seen-list)) - (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) - (if (elmo-file-cache-exists-p message-id) - (if seen - nil - already-mark) - (if seen - nil ;;seen-mark - new-mark)))) - (setq mark-alist - (elmo-msgdb-mark-append - mark-alist - number - gmark))))) - (elmo-progress-notify 'elmo-folder-msgdb-create)) - (elmo-progress-clear 'elmo-folder-msgdb-create)) - (list overview number-alist mark-alist))))) + numlist seen-list) + (let* ((target-folder (elmo-filter-folder-target-internal folder)) + (len (length numlist)) + (msgdb (elmo-folder-msgdb target-folder)) + overview number-alist mark-alist message-id entity) + (when (> len elmo-display-progress-threshold) + (elmo-progress-set 'elmo-folder-msgdb-create + len "Creating msgdb...")) + (unwind-protect + (dolist (number numlist) + (setq entity (elmo-msgdb-overview-get-entity number msgdb)) + (when entity + (setq overview (elmo-msgdb-append-element overview entity) + message-id (elmo-msgdb-overview-entity-get-id entity) + number-alist (elmo-msgdb-number-add number-alist + number + message-id) + mark-alist (elmo-msgdb-mark-append + mark-alist + number + (elmo-msgdb-get-mark msgdb number)))) + (elmo-progress-notify 'elmo-folder-msgdb-create)) + (elmo-progress-clear 'elmo-folder-msgdb-create)) + (list overview number-alist mark-alist))) (luna-define-method elmo-folder-append-buffer ((folder elmo-filter-folder) unread &optional number) @@ -160,48 +163,27 @@ ;; not available t))) -(defsubst elmo-filter-folder-list-unreads-internal (folder unread-marks - mark-alist) - (let ((unreads (elmo-folder-list-unreads-internal - (elmo-filter-folder-target-internal folder) - unread-marks - (or mark-alist - (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder)))))) - (unless (listp unreads) - (setq unreads - (delq nil - (mapcar - (function - (lambda (x) - (if (member (cadr x) unread-marks) - (car x)))) - (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder)))))) +(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 ((folder elmo-filter-folder)) + (elmo-filter-folder-list-unreads folder)) + +(defsubst elmo-filter-folder-list-importants (folder) + (elmo-uniq-list + (nconc (elmo-list-filter - (mapcar 'car (elmo-msgdb-get-number-alist - (elmo-folder-msgdb folder))) - unreads))) - -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-filter-folder) - unread-marks &optional mark-alist) - (elmo-filter-folder-list-unreads-internal folder unread-marks mark-alist)) - -(defsubst elmo-filter-folder-list-importants-internal (folder important-mark) - (let ((importants (elmo-folder-list-importants-internal - (elmo-filter-folder-target-internal folder) - important-mark))) - (if (listp importants) - (elmo-list-filter - (mapcar 'car (elmo-msgdb-get-number-alist - (elmo-folder-msgdb folder))) - importants) - t))) + (elmo-folder-list-messages folder nil 'in-msgdb) + (elmo-folder-list-importants + (elmo-filter-folder-target-internal folder))) + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark)))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-filter-folder) - important-mark) - (elmo-filter-folder-list-importants-internal folder important-mark)) +(luna-define-method elmo-folder-list-importants ((folder elmo-filter-folder)) + (elmo-filter-folder-list-importants folder)) (luna-define-method elmo-folder-list-subfolders ((folder elmo-filter-folder) &optional one-level) @@ -277,26 +259,49 @@ (elmo-message-file-name (elmo-filter-folder-target-internal folder) number)) -(luna-define-method elmo-folder-mark-as-read ((folder elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-mark-as-read :around ((folder + elmo-filter-folder) + numbers) (elmo-folder-mark-as-read (elmo-filter-folder-target-internal folder) - numbers)) + numbers) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-read ((folder elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-unmark-read :around ((folder + elmo-filter-folder) + numbers) (elmo-folder-unmark-read (elmo-filter-folder-target-internal folder) - numbers)) + numbers) + (luna-call-next-method)) -(luna-define-method elmo-folder-mark-as-important ((folder elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-mark-as-important :around ((folder + elmo-filter-folder) + numbers) (elmo-folder-mark-as-important (elmo-filter-folder-target-internal folder) - numbers)) + numbers) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-important ((folder elmo-filter-folder) - numbers) - (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder) - numbers)) +(luna-define-method elmo-folder-unmark-important :around ((folder + elmo-filter-folder) + numbers) + (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder) + numbers) + (luna-call-next-method)) + +(luna-define-method elmo-folder-mark-as-answered :around ((folder + elmo-filter-folder) + numbers) + (elmo-folder-mark-as-answered (elmo-filter-folder-target-internal folder) + numbers) + (luna-call-next-method)) + + +(luna-define-method elmo-folder-unmark-answered :around ((folder + elmo-filter-folder) + numbers) + (elmo-folder-unmark-answered (elmo-filter-folder-target-internal folder) + numbers) + (luna-call-next-method)) (require 'product) (product-provide (provide 'elmo-filter) (require 'elmo-version)) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index f0d1f7a..17e24ec 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -770,18 +770,16 @@ If CHOP-LENGTH is not specified, message set is not chopped." ;; ;; app-data: -;; cons of list -;; 0: new-mark 1: already-mark 2: seen-mark 3: important-mark -;; 4: seen-list -;; and result of use-flag-p. +;; cons of seen-list and result of use-flag-p. (defsubst elmo-imap4-fetch-callback-1-subr (entity flags app-data) "A msgdb entity callback function." (let* ((use-flag (cdr app-data)) (app-data (car app-data)) - (seen (member (car entity) (nth 4 app-data))) + (seen (member (car entity) app-data)) mark) (if (member "\\Flagged" flags) - (elmo-msgdb-global-mark-set (car entity) (nth 3 app-data))) + (elmo-msgdb-global-mark-set (car entity) + elmo-msgdb-important-mark)) (if (setq mark (elmo-msgdb-global-mark-get (car entity))) (unless (member "\\Seen" flags) (setq elmo-imap4-seen-messages @@ -794,13 +792,13 @@ If CHOP-LENGTH is not specified, message set is not chopped." (and use-flag (member "\\Seen" flags))) nil - (nth 1 app-data)) + elmo-msgdb-unread-cached-mark) (if (or seen (and use-flag (member "\\Seen" flags))) (if elmo-imap4-use-cache - (nth 2 app-data)) - (nth 0 app-data)))))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark))))) (setq elmo-imap4-current-msgdb (elmo-msgdb-append elmo-imap4-current-msgdb @@ -1861,6 +1859,10 @@ Return nil if no complete line has arrived." ((folder elmo-imap4-folder)) (elmo-imap4-list folder "flagged")) +(luna-define-method elmo-folder-list-answereds-plugged + ((folder elmo-imap4-folder)) + (elmo-imap4-list folder "answered")) + (luna-define-method elmo-folder-use-flag-p ((folder elmo-imap4-folder)) (not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp (elmo-imap4-folder-mailbox-internal folder)))) @@ -2075,7 +2077,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (defun elmo-imap4-search-internal-primitive (folder session filter from-msgs) (let ((search-key (elmo-filter-key filter)) (imap-search-keys '("bcc" "body" "cc" "from" "subject" "to" - "larger" "smaller")) + "larger" "smaller" "status")) (total 0) (length (length from-msgs)) charset set-list end results) @@ -2093,6 +2095,12 @@ If optional argument REMOVE is non-nil, remove FLAG." numbers))) (mapcar '(lambda (x) (delete x numbers)) rest) numbers)) + ((string= "status" search-key) + (cond + ((string= "unread" (elmo-filter-value filter)) + (elmo-folder-list-unreads folder)) + ((string= "unread" (elmo-filter-value filter)) + (elmo-folder-list-importants folder)))) ((or (string= "since" search-key) (string= "before" search-key)) (setq search-key (concat "sent" search-key) @@ -2220,7 +2228,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (luna-call-next-method))) (luna-define-method elmo-folder-msgdb-create-plugged - ((folder elmo-imap4-folder) numbers &rest args) + ((folder elmo-imap4-folder) numbers seen-list) (when numbers (let ((session (elmo-imap4-get-session folder)) (headers @@ -2245,7 +2253,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (setq elmo-imap4-current-msgdb nil elmo-imap4-seen-messages nil elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1 - elmo-imap4-fetch-callback-data (cons args + elmo-imap4-fetch-callback-data (cons seen-list (elmo-folder-use-flag-p folder))) (while set-list @@ -2285,6 +2293,14 @@ If optional argument REMOVE is non-nil, remove FLAG." ((folder elmo-imap4-folder) numbers) (elmo-imap4-set-flag folder numbers "\\Seen")) +(luna-define-method elmo-folder-unmark-answered-plugged + ((folder elmo-imap4-folder) numbers) + (elmo-imap4-set-flag folder numbers "\\Answered" 'remove)) + +(luna-define-method elmo-folder-mark-as-answered-plugged + ((folder elmo-imap4-folder) numbers) + (elmo-imap4-set-flag folder numbers "\\Answered")) + (luna-define-method elmo-message-use-cache-p ((folder elmo-imap4-folder) number) elmo-imap4-use-cache) @@ -2493,8 +2509,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-net-folder-user-internal (, folder2))))))) (luna-define-method elmo-folder-append-messages :around - ((folder elmo-imap4-folder) src-folder numbers unread-marks - &optional same-number) + ((folder elmo-imap4-folder) src-folder numbers &optional same-number) (if (and (eq (elmo-folder-type-internal src-folder) 'imap4) (elmo-imap4-identical-system-p folder src-folder) (elmo-folder-plugged-p folder)) @@ -2585,7 +2600,10 @@ If optional argument REMOVE is non-nil, remove FLAG." (goto-char (point-min)) (std11-field-body (symbol-name field))))) - +(luna-define-method elmo-folder-search-requires-msgdb-p ((folder + elmo-imap4-folder) + condition) + nil) (require 'product) (product-provide (provide 'elmo-imap4) (require 'elmo-version)) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 2fa24e5..4907de0 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -140,10 +140,6 @@ (luna-define-method elmo-folder-msgdb-create ((folder elmo-localdir-folder) numbers - new-mark - already-mark - seen-mark - important-mark seen-list) (when numbers (let ((dir (elmo-localdir-folder-directory-internal folder)) @@ -172,10 +168,10 @@ (if (elmo-file-cache-exists-p message-id) ; XXX (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen nil ;;seen-mark - new-mark)))) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -227,7 +223,7 @@ (luna-define-method elmo-folder-append-messages :around ((folder elmo-localdir-folder) - src-folder numbers unread-marks &optional same-number) + src-folder numbers &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-localdir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 6fe8c22..37ed43a 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -132,8 +132,7 @@ LOCATION." (elmo-maildir-folder-flagged-locations-internal folder)) (luna-define-method elmo-folder-msgdb-create - ((folder elmo-maildir-folder) - numbers new-mark already-mark seen-mark important-mark seen-list) + ((folder elmo-maildir-folder) numbers seen-list) (let* ((unread-list (elmo-maildir-folder-unread-locations-internal folder)) (flagged-list (elmo-maildir-folder-flagged-locations-internal folder)) (len (length numbers)) @@ -159,9 +158,9 @@ LOCATION." entity))) (cond ((member location unread-list) - (setq mark new-mark)) ; unread! + (setq mark elmo-msgdb-new-mark)) ; unread! ((member location flagged-list) - (setq mark important-mark))) + (setq mark elmo-msgdb-important-mark))) (if (setq mark (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) @@ -397,7 +396,7 @@ file name for maildir directories." (luna-define-method elmo-folder-append-messages :around ((folder elmo-maildir-folder) - src-folder numbers unread-marks &optional same-number) + src-folder numbers &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-maildir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index cb13519..69ab1c9 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -291,18 +291,21 @@ (elmo-map-message-location folder number) strategy section unread)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-map-folder) unread-marks &optional mark-alist) - (elmo-map-folder-locations-to-numbers - folder - (elmo-map-folder-list-unreads folder))) +(luna-define-method elmo-folder-list-unreads ((folder elmo-map-folder)) + (let ((locations (elmo-map-folder-list-unreads folder))) + (if (listp locations) + (elmo-map-folder-locations-to-numbers + folder + (elmo-map-folder-list-unreads folder))))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-map-folder) important-mark) +(luna-define-method elmo-folder-list-importants ((folder elmo-map-folder)) (let ((locations (elmo-map-folder-list-importants folder))) (if (listp locations) - (elmo-map-folder-locations-to-numbers folder locations) - t))) + (elmo-uniq-list + (nconc (elmo-map-folder-locations-to-numbers folder locations) + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark))) + (luna-call-next-method)))) (luna-define-method elmo-folder-delete-messages ((folder elmo-map-folder) numbers) @@ -318,7 +321,6 @@ folder)) (elmo-map-folder-location-alist-internal folder)))) t) ; success - (require 'product) (product-provide (provide 'elmo-map) (require 'elmo-version)) diff --git a/elmo/elmo-mark.el b/elmo/elmo-mark.el index 02cdde2..cc2cc44 100644 --- a/elmo/elmo-mark.el +++ b/elmo/elmo-mark.el @@ -84,15 +84,10 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-mark-folder) - numbers new-mark - already-mark seen-mark - important-mark - seen-list) - (elmo-mark-folder-msgdb-create folder numbers new-mark already-mark - seen-mark important-mark)) - -(defun elmo-mark-folder-msgdb-create (folder numbers new-mark already-mark - seen-mark important-mark) + numbers seen-list) + (elmo-mark-folder-msgdb-create folder numbers)) + +(defun elmo-mark-folder-msgdb-create (folder numbers) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -165,10 +160,6 @@ t) ;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-mark-folder) unread-marks &optional mark-alist) - t) - (luna-define-method elmo-folder-unmark-important ((folder elmo-mark-folder) numbers) t) diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 7364c5c..bf29c73 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -38,6 +38,42 @@ (require 'std11) (require 'mime) +(defcustom elmo-msgdb-new-mark "N" + "Mark for new message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-unread-uncached-mark "U" + "Mark for unread and uncached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-unread-cached-mark "!" + "Mark for unread but already cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-read-uncached-mark "u" + "Mark for read but uncached message." + :type '(string :tag "Mark") + :group 'elmo) + +;; Not implemented yet. +(defcustom elmo-msgdb-answered-cached-mark "&" + "Mark for answered and cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-answered-uncached-mark "A" + "Mark for answered but cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-important-mark"$" + "Mark for important message." + :type '(string :tag "Mark") + :group 'elmo) + ;;; MSGDB interface. (defun elmo-load-msgdb (path) "Load the MSGDB from PATH." @@ -60,25 +96,175 @@ (defsubst elmo-msgdb-set-mark (msgdb number mark) "Set MARK of the message with NUMBER in the MSGDB. if MARK is nil, mark is removed." - (elmo-msgdb-set-mark-alist - msgdb - (elmo-msgdb-mark-alist-set (elmo-msgdb-get-mark-alist msgdb) - number - mark msgdb)) - (unless mark - (elmo-clear-hash-val (format "#%d" number) - (elmo-msgdb-get-mark-hashtb msgdb)))) - -(defsubst elmo-msgdb-count-marks (msgdb new-mark unread-marks) + (let ((elem (elmo-get-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb)))) + (if elem + (if mark + ;; Set mark of the elem + (setcar (cdr elem) mark) + ;; Delete elem from mark-alist + (elmo-msgdb-set-mark-alist + msgdb + (delq elem (elmo-msgdb-get-mark-alist msgdb))) + (elmo-clear-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb))) + (when mark + ;; Append new element. + (elmo-msgdb-set-mark-alist + msgdb + (nconc + (elmo-msgdb-get-mark-alist msgdb) + (list (setq elem (list number mark))))) + (elmo-set-hash-val (format "#%d" number) elem + (elmo-msgdb-get-mark-hashtb msgdb)))))) + +(defun elmo-msgdb-set-cached (msgdb number cached) + "Set message cache status." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) + (unless (eq (not cached) (not cur-cached)) + (case cur-status + (read + (elmo-msgdb-set-mark msgdb number + (unless cached + elmo-msgdb-read-uncached-mark))) + (important nil) + (answered + (elmo-msgdb-set-mark msgdb number + (if cached + elmo-msgdb-answered-cached-mark + elmo-msgdb-answered-uncached-mark))) + (t + (elmo-msgdb-set-mark msgdb number + (if cached + elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark))))))) + +(defun elmo-msgdb-set-status (msgdb folder number status) + "Set message status. +MSGDB is the ELMO msgdb. +FOLDER is a ELMO folder structure. +NUMBER is a message number to be set status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (use-cache (elmo-message-use-cache-p folder number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks)))) + mark-modified) + (case status + (read + (case cur-status + ((read important answered)) + (t (elmo-msgdb-set-mark msgdb number + (if (and use-cache cur-cached) + (elmo-msgdb-set-mark + msgdb number + elmo-msgdb-read-uncached-mark))) + (setq mark-modified t)))) + (important + (unless (eq cur-status 'important) + (elmo-msgdb-set-mark msgdb number elmo-msgdb-important-mark) + (setq mark-modified t))) + (answered + (unless (or (eq cur-status 'answered) (eq cur-status 'important)) + (elmo-msgdb-set-mark msgdb number + (if cur-cached + (if use-cache + elmo-msgdb-answered-cached-mark + elmo-msgdb-answered-uncached-mark) + elmo-msgdb-answered-uncached-mark))) + (setq mark-modified t))) + (if mark-modified (elmo-folder-set-mark-modified-internal folder t)))) + +(defun elmo-msgdb-unset-status (msgdb folder number status) + "Unset message status. +MSGDB is the ELMO msgdb. +FOLDER is a ELMO folder structure. +NUMBER is a message number to be set status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (use-cache (elmo-message-use-cache-p folder number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) + (case status + (read + (if (eq cur-status 'read) + (elmo-msgdb-set-mark msgdb number + (if (and cur-cached use-cache) + elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark)))) + (important + (if (eq cur-status 'important) + (elmo-msgdb-set-mark msgdb number nil))) + (answered + (if (eq cur-status 'answered) + (elmo-msgdb-set-mark msgdb number + (if (and cur-cached (not use-cache)) + elmo-msgdb-read-uncached-mark))))))) + +(defvar elmo-msgdb-unread-marks-internal nil) +(defsubst elmo-msgdb-unread-marks () + "Return an unread mark list" + (or elmo-msgdb-unread-marks-internal + (setq elmo-msgdb-unread-marks-internal + (list elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark)))) + +(defvar elmo-msgdb-answered-marks-internal nil) +(defsubst elmo-msgdb-answered-marks () + "Return an answered mark list" + (or elmo-msgdb-answered-marks-internal + (setq elmo-msgdb-answered-marks-internal + (list elmo-msgdb-answered-cached-mark + elmo-msgdb-answered-uncached-mark)))) + +(defvar elmo-msgdb-uncached-marks-internal nil) +(defsubst elmo-msgdb-uncached-marks () + (or elmo-msgdb-uncached-marks-internal + (setq elmo-msgdb-uncached-marks-internal + (list elmo-msgdb-answered-uncached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-read-uncached-mark)))) + +(defsubst elmo-msgdb-count-marks (msgdb) (let ((new 0) - (unreads 0)) + (unreads 0) + (answered 0)) (dolist (elem (elmo-msgdb-get-mark-alist msgdb)) (cond - ((string= (cadr elem) new-mark) + ((string= (cadr elem) elmo-msgdb-new-mark) (incf new)) - ((member (cadr elem) unread-marks) - (incf unreads)))) - (cons new unreads))) + ((member (cadr elem) (elmo-msgdb-unread-marks)) + (incf unreads)) + ((member (cadr elem) (elmo-msgdb-answered-marks)) + (incf answered)))) + (list new unreads answered))) (defsubst elmo-msgdb-get-number (msgdb message-id) "Get number of the message which corrensponds to MESSAGE-ID from MSGDB." @@ -253,30 +439,13 @@ content of MSGDB is changed." ;;; ;; persistent mark handling ;; (for each folder) -(defun elmo-msgdb-mark-alist-set (alist id mark msgdb) - (let ((ret-val alist) - entity) - (setq entity (assq id alist)) - (if entity - (if (eq mark nil) - ;; delete this entity - (setq ret-val (delq entity alist)) - ;; set mark - (setcar (cdr entity) mark)) - (when mark - (setq ret-val (elmo-msgdb-append-element ret-val - (setq entity - (list id mark)))) - (elmo-set-hash-val (format "#%d" id) entity - (elmo-msgdb-get-mark-hashtb msgdb)))) - ret-val)) (defun elmo-msgdb-mark-append (alist id mark) "Append mark." (setq alist (elmo-msgdb-append-element alist (list id mark)))) -(defun elmo-msgdb-seen-list (msgdb seen-marks) +(defun elmo-msgdb-seen-list (msgdb) "Get SEEN-MSGID-LIST from MSGDB." (let ((ov (elmo-msgdb-get-overview msgdb)) mark seen-list) @@ -284,7 +453,8 @@ content of MSGDB is changed." (if (setq mark (elmo-msgdb-get-mark msgdb (elmo-msgdb-overview-entity-get-number (car ov)))) - (if (and mark (member mark seen-marks)) + (if (and mark (member mark (list elmo-msgdb-important-mark + elmo-msgdb-read-uncached-mark))) (setq seen-list (cons (elmo-msgdb-overview-entity-get-id (car ov)) seen-list))) @@ -749,12 +919,12 @@ header separator." elmo-msgdb-directory) alist)) -(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb unread-marks seen-list) +(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb seen-list) ;; Add to seen list. (let (mark) (while msgs (if (setq mark (elmo-msgdb-get-mark msgdb (car msgs))) - (unless (member mark unread-marks) ;; not unread mark + (unless (member mark (elmo-msgdb-unread-marks)) ;; not unread mark (setq seen-list (cons (elmo-msgdb-get-field msgdb (car msgs) 'message-id) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index a4d0da5..3090237 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -65,12 +65,16 @@ (luna-define-method elmo-folder-check ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) - (elmo-folder-check fld))) + (elmo-folder-synchronize fld))) (luna-define-method elmo-folder-close-internal ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) (elmo-folder-close-internal fld))) +(luna-define-method elmo-folder-close :around ((folder elmo-multi-folder)) + (dolist (fld (elmo-multi-folder-children-internal folder)) + (elmo-folder-close fld))) + (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-multi-folder)) (expand-file-name (elmo-replace-string-as-filename @@ -152,9 +156,7 @@ numbers-list)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-multi-folder) - numbers new-mark already-mark - seen-mark important-mark - seen-list) + numbers seen-list) (let* ((folders (elmo-multi-folder-children-internal folder)) overview number-alist mark-alist entity numbers-list @@ -171,8 +173,6 @@ (elmo-multi-msgdb (elmo-folder-msgdb-create (nth cur-number folders) (nth cur-number numbers-list) - new-mark already-mark - seen-mark important-mark seen-list) (* (elmo-multi-folder-divide-number-internal folder) (1+ cur-number)))))) @@ -385,70 +385,53 @@ (setq result (nconc result (list one-alist)))) result)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-multi-folder) unread-marks &optional mark-alist) - (elmo-multi-folder-list-unreads-internal folder unread-marks)) - -(defun elmo-multi-folder-list-unreads-internal (folder unread-marks) - (let ((folders (elmo-multi-folder-children-internal folder)) - (mark-alists (elmo-multi-split-mark-alist - folder - (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder)))) - (cur-number 0) - unreads - all-unreads) - (while folders +(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)) - (unless (listp (setq unreads - (elmo-folder-list-unreads-internal - (car folders) unread-marks (car mark-alists)))) - (setq unreads (delq nil - (mapcar - (lambda (x) - (if (member (cadr x) unread-marks) - (car x))) - (car mark-alists))))) - (setq all-unreads - (nconc all-unreads - (mapcar - (lambda (x) - (+ x - (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - unreads))) - (setq mark-alists (cdr mark-alists) - folders (cdr folders))) - all-unreads)) - -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-multi-folder) important-mark) - (let ((folders (elmo-multi-folder-children-internal folder)) - (mark-alists (elmo-multi-split-mark-alist - folder - (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder)))) - (cur-number 0) - importants - all-importants) - (while folders + (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)) - (when (listp (setq importants - (elmo-folder-list-importants-internal - (car folders) important-mark))) - (setq all-importants - (nconc all-importants - (mapcar - (lambda (x) - (+ x - (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - importants)))) - (setq mark-alists (cdr mark-alists) - folders (cdr folders))) - all-importants)) + (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))))) + (elmo-uniq-list + (nconc importants + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark))))) (luna-define-method elmo-folder-list-messages-internal ((folder elmo-multi-folder) &optional nohide) @@ -602,33 +585,53 @@ (setq msg-list (cdr msg-list))) ret-val)) -(luna-define-method elmo-folder-mark-as-important ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-important :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-important (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-important ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-important :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-important (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-mark-as-read ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-read :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-read (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-read ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-read :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-read (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) + +(luna-define-method elmo-folder-mark-as-answered :around ((folder + elmo-multi-folder) + numbers) + (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) + (elmo-folder-mark-as-answered (car folder-numbers) + (cdr folder-numbers))) + (luna-call-next-method)) + +(luna-define-method elmo-folder-unmark-answered :around ((folder + elmo-multi-folder) + numbers) + (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) + (elmo-folder-unmark-answered (car folder-numbers) + (cdr folder-numbers))) + (luna-call-next-method)) (require 'product) (product-provide (provide 'elmo-multi) (require 'elmo-version)) diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 009dcae..1b824fe 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -393,19 +393,30 @@ 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-internal - ((folder elmo-net-folder) unread-marks &optional mark-alist) +(luna-define-method elmo-folder-list-unreads :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-unreads-plugged) - t)) + (luna-call-next-method))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-net-folder) important-mark) +(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) - t)) + (elmo-uniq-list + (nconc + (elmo-folder-send folder 'elmo-folder-list-importants-plugged) + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark))) + (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)) @@ -415,6 +426,10 @@ Returned value is searched from `elmo-network-stream-type-alist'." ((folder elmo-net-folder)) t) +(luna-define-method elmo-folder-list-answereds-plugged + ((folder elmo-net-folder)) + t) + (luna-define-method elmo-folder-delete-messages ((folder elmo-net-folder) numbers) (if (elmo-folder-plugged-p folder) @@ -427,34 +442,21 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-folder-delete-messages-dop folder numbers)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-net-folder) - numbers new-mark - already-mark seen-mark - important-mark seen-list) + numbers seen-list) (if (elmo-folder-plugged-p folder) (elmo-folder-send folder 'elmo-folder-msgdb-create-plugged - numbers - new-mark - already-mark seen-mark - important-mark seen-list) + numbers seen-list) (elmo-folder-send folder 'elmo-folder-msgdb-create-unplugged - numbers - new-mark already-mark seen-mark - important-mark seen-list))) + numbers seen-list))) (luna-define-method elmo-folder-msgdb-create-unplugged ((folder elmo-net-folder) numbers - new-mark already-mark - seen-mark - important-mark seen-list) ;; XXXX should be appended to already existing msgdb. (elmo-dop-msgdb (elmo-folder-msgdb-create (elmo-dop-spool-folder folder) (mapcar 'abs numbers) - new-mark already-mark - seen-mark - important-mark seen-list))) (luna-define-method elmo-folder-unmark-important ((folder elmo-net-folder) @@ -494,6 +496,26 @@ Returned value is searched from `elmo-network-stream-type-alist'." folder 'elmo-folder-mark-as-read-unplugged numbers)) t)) +(luna-define-method elmo-folder-unmark-answered ((folder elmo-net-folder) + numbers) + (if (elmo-folder-use-flag-p folder) + (if (elmo-folder-plugged-p folder) + (elmo-folder-send folder 'elmo-folder-unmark-answered-plugged + numbers) + (elmo-folder-send folder + 'elmo-folder-unmark-answered-unplugged numbers)) + (luna-call-next-method))) + +(luna-define-method elmo-folder-mark-as-answered ((folder elmo-net-folder) + numbers) + (if (elmo-folder-use-flag-p folder) + (if (elmo-folder-plugged-p folder) + (elmo-folder-send folder 'elmo-folder-mark-as-answered-plugged + numbers) + (elmo-folder-send folder 'elmo-folder-mark-as-answered-unplugged + numbers)) + (luna-call-next-method))) + (luna-define-method elmo-folder-mark-as-read-unplugged ((folder elmo-net-folder) numbers) @@ -513,6 +535,15 @@ Returned value is searched from `elmo-network-stream-type-alist'." numbers) (elmo-folder-unmark-important-dop folder numbers)) +(luna-define-method elmo-folder-mark-as-answered-unplugged ((folder + elmo-net-folder) + numbers) + (elmo-folder-mark-as-answered-dop folder numbers)) + +(luna-define-method elmo-folder-unmark-answered-unplugged + ((folder elmo-net-folder) numbers) + (elmo-folder-unmark-answered-dop folder numbers)) + (luna-define-method elmo-message-encache :around ((folder elmo-net-folder) number &optional read) (if (elmo-folder-plugged-p folder) diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index bc46e71..4459d24 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -117,10 +117,7 @@ If the value is a list, all elements are used as index paths for namazu." entity)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder) - numlist new-mark - already-mark seen-mark - important-mark - seen-list) + numlist seen-list) (let* (overview number-alist mark-alist entity i percent num pair) (setq num (length numlist)) @@ -148,7 +145,7 @@ If the value is a list, all elements are used as index paths for namazu." (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) - new-mark)))) + elmo-msgdb-new-mark)))) (when (> num elmo-display-progress-threshold) (setq i (1+ i)) (setq percent (/ (* i 100) num)) @@ -254,25 +251,6 @@ If the value is a list, all elements are used as index paths for namazu." (luna-define-method elmo-folder-exists-p ((folder elmo-nmz-folder)) t) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-nmz-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-nmz-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-nmz-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-nmz-folder) numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-nmz-folder) numbers) - t) - (require 'product) (product-provide (provide 'elmo-nmz) (require 'elmo-version)) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 74030a8..fd1e85c 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -703,10 +703,6 @@ Don't cache if nil.") ("xref" . 8))) (defun elmo-nntp-create-msgdb-from-overview-string (str - new-mark - already-mark - seen-mark - important-mark seen-list &optional numlist) (let (ov-list gmark message-id seen @@ -768,11 +764,11 @@ Don't cache if nil.") (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-nntp-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist num gmark)))) @@ -780,16 +776,10 @@ Don't cache if nil.") (list overview number-alist mark-alist))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nntp-folder) - numbers new-mark already-mark - seen-mark important-mark - seen-list) - (elmo-nntp-folder-msgdb-create folder numbers new-mark already-mark - seen-mark important-mark - seen-list)) - -(defun elmo-nntp-folder-msgdb-create (folder numbers new-mark already-mark - seen-mark important-mark - seen-list) + numbers seen-list) + (elmo-nntp-folder-msgdb-create folder numbers seen-list)) + +(defun elmo-nntp-folder-msgdb-create (folder numbers seen-list) (let ((filter numbers) (session (elmo-nntp-get-session folder)) beg-num end-num cur length @@ -818,10 +808,6 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str - new-mark - already-mark - seen-mark - important-mark seen-list filter ))))) @@ -843,8 +829,7 @@ Don't cache if nil.") 'elmo-nntp-msgdb-create "Getting overview..." 100))) (if (not use-xover) (setq ret-val (elmo-nntp-msgdb-create-by-header - session numbers - new-mark already-mark seen-mark seen-list)) + session numbers seen-list)) (with-current-buffer (elmo-network-session-buffer session) (if ov-str (setq ret-val @@ -852,10 +837,6 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str - new-mark - already-mark - seen-mark - important-mark seen-list filter)))))) (elmo-folder-set-killed-list-internal @@ -916,13 +897,11 @@ Don't cache if nil.") (nconc number-alist (list (cons max-number nil)))))))))) -(defun elmo-nntp-msgdb-create-by-header (session numbers - new-mark already-mark - seen-mark seen-list) +(defun elmo-nntp-msgdb-create-by-header (session numbers seen-list) (with-temp-buffer (elmo-nntp-retrieve-headers session (current-buffer) numbers) (elmo-nntp-msgdb-create-message - (length numbers) new-mark already-mark seen-mark seen-list))) + (length numbers) seen-list))) (defun elmo-nntp-parse-xhdr-response (string) (let (response) @@ -1401,8 +1380,7 @@ Returns a list of cons cells like (NUMBER . VALUE)" ;; end of from Gnus -(defun elmo-nntp-msgdb-create-message (len new-mark - already-mark seen-mark seen-list) +(defun elmo-nntp-msgdb-create-message (len seen-list) (save-excursion (let (beg overview number-alist mark-alist entity i num gmark seen message-id) @@ -1441,11 +1419,11 @@ Returns a list of cons cells like (NUMBER . VALUE)" (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-nntp-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -1578,19 +1556,12 @@ Returns a list of cons cells like (NUMBER . VALUE)" elmo-crosspost-message-alist))) (elmo-nntp-folder-set-reads-internal folder reads))) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-nntp-folder) unread-marks mark-alist) +(luna-define-method elmo-folder-list-unreads :around ((folder + elmo-nntp-folder)) ;; 2.3. elmo-folder-list-unreads return unread message list according to ;; `reads' slot. - (let ((mark-alist (or mark-alist (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder))))) - (elmo-living-messages (delq nil - (mapcar - (lambda (x) - (if (member (nth 1 x) unread-marks) - (car x))) - mark-alist)) - (elmo-nntp-folder-reads-internal folder)))) + (elmo-living-messages (luna-call-next-method) + (elmo-nntp-folder-reads-internal folder))) (require 'product) (product-provide (provide 'elmo-nntp) (require 'elmo-version)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index e2dfc04..678ec41 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -66,20 +66,15 @@ (elmo-folder-contains-type (elmo-pipe-folder-dst-internal folder) type))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pipe-folder) - numlist new-mark already-mark - seen-mark important-mark - seen-list) + numlist seen-list) (elmo-folder-msgdb-create (elmo-pipe-folder-dst-internal folder) - numlist new-mark already-mark - seen-mark important-mark seen-list)) + numlist seen-list)) (luna-define-method elmo-folder-append-messages ((folder elmo-pipe-folder) src-folder numbers - unread-marks &optional same-number) (elmo-folder-append-messages (elmo-pipe-folder-dst-internal folder) src-folder numbers - unread-marks same-number)) (luna-define-method elmo-folder-append-buffer ((folder elmo-pipe-folder) @@ -177,15 +172,14 @@ (elmo-folder-list-messages-internal (elmo-pipe-folder-dst-internal folder) nohide)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-pipe-folder) unread-marks &optional mark-alist) - (elmo-folder-list-unreads-internal (elmo-pipe-folder-dst-internal folder) - unread-marks mark-alist)) +(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-internal - ((folder elmo-pipe-folder) important-mark) - (elmo-folder-list-importants-internal (elmo-pipe-folder-dst-internal folder) - important-mark)) +(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-status ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-src-internal folder)) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index d594e93..0192041 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -677,9 +677,7 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (copy-to-buffer tobuffer (point-min) (point-max))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pop3-folder) - numlist new-mark - already-mark seen-mark - important-mark seen-list) + numlist seen-list) (let ((process (elmo-network-session-process-internal (elmo-pop3-get-session folder)))) (with-current-buffer (process-buffer process) @@ -688,8 +686,7 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (elmo-pop3-msgdb-create-by-header process numlist - new-mark already-mark - seen-mark seen-list + seen-list (if (elmo-pop3-folder-use-uidl-internal folder) (elmo-pop3-folder-location-alist-internal folder))))))) @@ -727,8 +724,6 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." elmo-pop3-size-hash)) (defun elmo-pop3-msgdb-create-by-header (process numlist - new-mark already-mark - seen-mark seen-list loc-alist) (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))) @@ -749,14 +744,13 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." process (length numlist) numlist - new-mark already-mark seen-mark seen-list loc-alist) + seen-list loc-alist) (kill-buffer tmp-buffer))))) (defun elmo-pop3-msgdb-create-message (buffer process num - numlist new-mark already-mark - seen-mark + numlist seen-list loc-alist) (save-excursion @@ -807,11 +801,11 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-pop3-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index 3cf0bc5..de753f8 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -81,10 +81,7 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-sendlog-folder) - numbers new-mark - already-mark seen-mark - important-mark - seen-list) + numbers seen-list) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -110,7 +107,8 @@ num message-id)) (if (setq mark (or (elmo-msgdb-global-mark-get message-id) - (if (member message-id seen-list) nil new-mark))) + (if (member message-id seen-list) nil + elmo-msgdb-new-mark))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -152,27 +150,6 @@ (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number) t) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-sendlog-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-sendlog-folder) - numbers) - t) - (require 'product) (product-provide (provide 'elmo-sendlog) (require 'elmo-version)) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index 1e2bf02..25bf6d0 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -341,10 +341,7 @@ update overview when message is fetched." (list (cons "xref" (shimbun-header-xref header))))))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder) - numlist new-mark - already-mark seen-mark - important-mark - seen-list) + numlist seen-list) (let* (overview number-alist mark-alist entity i percent number length pair msgid gmark seen) (setq length (length numlist)) @@ -367,11 +364,11 @@ update overview when message is fetched." (if (setq gmark (or (elmo-msgdb-global-mark-get msgid) (if (elmo-file-cache-status (elmo-file-cache-get msgid)) - (if seen nil already-mark) + (if seen nil elmo-msgdb-unread-cached-mark) (if seen (if elmo-shimbun-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist number gmark)))) @@ -509,27 +506,6 @@ update overview when message is fetched." folder)))) t)) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-shimbun-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-shimbun-folder) - numbers) - t) - (require 'product) (product-provide (provide 'elmo-shimbun) (require 'elmo-version)) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 1205733..384d976 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -232,7 +232,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (goto-char (match-end 0)))) ;; search-key ::= [A-Za-z-]+ ;; ;; "since" / "before" / "last" / "first" / -;; ;; "body" / field-name +;; ;; "body" / "status" / field-name ((looking-at "\\(!\\)? *\\([A-Za-z-]+\\) *: *") (goto-char (match-end 0)) (let ((search-key (vector diff --git a/elmo/elmo.el b/elmo/elmo.el index a59b76e..ef66b76 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -148,11 +148,13 @@ If optional argument NON-PERSISTENT is non-nil, folder is treated as (save-match-data (elmo-folder-send folder 'elmo-folder-initialize name)))) -(defmacro elmo-folder-msgdb (folder) - "Return the msgdb of FOLDER (on-demand loading)." - (` (or (elmo-folder-msgdb-internal (, folder)) - (elmo-folder-set-msgdb-internal (, folder) - (elmo-msgdb-load (, folder)))))) +(luna-define-generic elmo-folder-msgdb (folder) + "Return the msgdb of FOLDER (on-demand loading).") + +(luna-define-method elmo-folder-msgdb ((folder elmo-folder)) + (or (elmo-folder-msgdb-internal folder) + (elmo-folder-set-msgdb-internal folder + (elmo-msgdb-load folder)))) (luna-define-generic elmo-folder-open (folder &optional load-msgdb) "Open and setup (load saved status) FOLDER. @@ -204,56 +206,72 @@ Return value is cons cell or list: (luna-define-generic elmo-folder-reserve-status-p (folder) "If non-nil, the folder should not close folder after `elmo-folder-status'.") -(defun elmo-folder-list-messages (folder &optional visible-only) +(defun elmo-folder-list-messages (folder &optional visible-only in-msgdb) "Return a list of message numbers contained in FOLDER. -If optional VISIBLE-ONLY is non-nil, killed messages are not listed." - (let ((list (elmo-folder-list-messages-internal folder visible-only)) - (killed (elmo-folder-killed-list-internal folder)) - numbers) - (setq numbers - (if (listp list) - list - ;; Not available, use current list. - (mapcar - 'car - (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder))))) - (elmo-living-messages numbers killed))) - -(defun elmo-folder-list-unreads (folder unread-marks) - "Return a list of unread message numbers contained in FOLDER. -UNREAD-MARKS is the unread marks." - (let ((list (elmo-folder-list-unreads-internal folder - unread-marks))) - (if (listp list) - list - ;; Not available, use current mark. - (delq nil - (mapcar - (function - (lambda (x) - (if (member (cadr x) unread-marks) - (car x)))) - (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))))) - -(defun elmo-folder-list-importants (folder important-mark) - "Returns a list of important message numbers contained in FOLDER. -IMPORTANT-MARK is the important mark." - (let ((importants (elmo-folder-list-importants-internal folder important-mark)) - (number-alist (elmo-msgdb-get-number-alist - (elmo-folder-msgdb folder))) - num-pair result) +If optional VISIBLE-ONLY is non-nil, killed messages are not listed. +If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed." + (let ((list (if in-msgdb + t + (elmo-folder-list-messages-internal folder visible-only)))) + (elmo-living-messages + (if (listp list) + list + ;; Use current list. + (mapcar + 'car + (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder)))) + (elmo-folder-killed-list-internal folder)))) + +(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-method elmo-folder-list-unreads ((folder elmo-folder)) + (delq nil + (mapcar + (lambda (x) + (if (member (cadr x) (elmo-msgdb-unread-marks)) + (car x))) + (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))) + +;; TODO: Should reconsider the structure of global mark. +(defun elmo-folder-list-messages-with-global-mark (folder mark) + (let (entity msgs) (dolist (mark-pair (or elmo-msgdb-global-mark-alist (setq elmo-msgdb-global-mark-alist (elmo-object-load (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-directory))))) - (if (and (string= important-mark (cdr mark-pair)) - (setq num-pair (rassoc (car mark-pair) number-alist))) - (setq result (cons (car num-pair) result)))) - (if (listp importants) - (elmo-uniq-list (nconc result importants)) - result))) + (if (and (string= mark (cdr mark-pair)) + (setq entity + (elmo-msgdb-overview-get-entity (car mark-pair) + (elmo-folder-msgdb + folder)))) + (setq msgs (cons (elmo-msgdb-overview-entity-get-number entity) + msgs)))) + msgs)) + +(luna-define-method elmo-folder-list-importants ((folder elmo-folder)) + (elmo-uniq-list + (nconc + (elmo-folder-list-messages-with-global-mark folder + elmo-msgdb-important-mark) + (elmo-folder-list-messages-mark-match folder + (regexp-quote + elmo-msgdb-important-mark))))) + +(luna-define-method elmo-folder-list-answereds ((folder elmo-folder)) + (delq nil + (mapcar + (function + (lambda (x) + (if (member (cadr x) (elmo-msgdb-answered-marks)) + (car x)))) + (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))) (luna-define-generic elmo-folder-list-messages-internal (folder &optional visible-only) @@ -261,24 +279,10 @@ IMPORTANT-MARK is the important mark." ;; Return t if the message list is not available. ) -(luna-define-generic elmo-folder-list-unreads-internal (folder - unread-marks - &optional mark-alist) - ;; Return a list of unread message numbers contained in FOLDER. - ;; If optional MARK-ALIST is set, it is used as mark-alist. - ;; Return t if this feature is not available. - ) - -(luna-define-generic elmo-folder-list-importants-internal (folder - important-mark) - ;; Return a list of important message numbers contained in FOLDER. - ;; Return t if this feature is not available. - ) - (luna-define-generic elmo-folder-list-subfolders (folder &optional one-level) "Returns a list of subfolders contained in FOLDER. If optional argument ONE-LEVEL is non-nil, only children of FOLDER is returned. -(a folder which have children is returned as a list) +\(a folder which have children is returned as a list\) Otherwise, all descendent folders are returned.") (luna-define-generic elmo-folder-have-subfolder-p (folder) @@ -328,13 +332,10 @@ CONDITION is a condition structure for testing. NUMBERS is a list of message numbers, use to be test for \"last\" and \"first\" predicates.") -(luna-define-generic elmo-folder-msgdb-create - (folder numbers new-mark already-mark seen-mark important-mark seen-list) +(luna-define-generic elmo-folder-msgdb-create (folder numbers seen-list) "Create a message database (implemented in each backends). FOLDER is the ELMO folder structure. NUMBERS is a list of message numbers to create msgdb. -NEW-MARK, ALREADY-MARK, SEEN-MARK, and IMPORTANT-MARK are mark string for -new message, unread but cached message, read message and important message. SEEN-LIST is a list of message-id string which should be treated as read.") (luna-define-generic elmo-folder-unmark-important (folder numbers) @@ -357,6 +358,34 @@ NUMBERS is a list of message numbers to be processed.") FOLDER is the ELMO folder structure. NUMBERS is a list of message numbers to be processed.") +(luna-define-generic elmo-folder-unmark-answered (folder numbers) + "Un-mark messages as answered. +FOLDER is the ELMO folder structure. +NUMBERS is a list of message numbers to be processed.") + +(luna-define-generic elmo-folder-mark-as-answered (folder numbers) + "Mark messages as answered. +FOLDER is the ELMO folder structure. +NUMBERS is a list of message numbers to be processed.") + +(luna-define-generic elmo-folder-set-status (folder numbers status) + "Set message status. +FOLDER is the ELMO folder structure. +NUMBERS is a list of message numbers to be set status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered.") + +(luna-define-generic elmo-folder-unset-status (folder numbers status) + "Unset message status. +FOLDER is the ELMO folder structure. +NUMBERS is a list of message numbers to be unset status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered.") + (luna-define-generic elmo-folder-append-buffer (folder unread &optional number) "Append current buffer as a new message. FOLDER is the destination folder(ELMO folder structure). @@ -367,7 +396,6 @@ If optional argument NUMBER is specified, the new message number is set (luna-define-generic elmo-folder-append-messages (folder src-folder numbers - unread-marks &optional same-number) "Append messages from folder. @@ -376,7 +404,6 @@ Caller should make sure FOLDER is `writable'. (Can be checked with `elmo-folder-writable-p'). SRC-FOLDER is the source ELMO folder structure. NUMBERS is the message numbers to be appended in the SRC-FOLDER. -UNREAD-MARKS is a list of unread mark string. If second optional argument SAME-NUMBER is specified, message number is preserved (if possible).") @@ -521,14 +548,6 @@ Return newly created temporary directory name which contains temporary files.") ((folder elmo-folder) &optional visible-only) t) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-folder) important-mark) - t) - (defun elmo-folder-encache (folder numbers &optional unread) "Encache messages in the FOLDER with NUMBERS. If UNREAD is non-nil, messages are not marked as read." @@ -616,6 +635,22 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (luna-define-generic elmo-folder-newsgroups (folder) "Return list of newsgroup name of FOLDER.") +(luna-define-generic elmo-folder-search-requires-msgdb-p (folder condition) + "Return non-nil if searching in FOLDER by CONDITION requires msgdb fetch.") + +(defun elmo-folder-search-requires-msgdb-p-internal (folder condition) + (if (listp condition) + (or (elmo-folder-search-requires-msgdb-p-internal + folder (nth 1 condition)) + (elmo-folder-search-requires-msgdb-p-internal + folder (nth 2 condition))) + (and (not (string= (elmo-filter-key condition) "last")) + (not (string= (elmo-filter-key condition) "first"))))) + +(luna-define-method elmo-folder-search-requires-msgdb-p ((folder elmo-folder) + condition) + (elmo-folder-search-requires-msgdb-p-internal folder condition)) + (luna-define-method elmo-folder-newsgroups ((folder elmo-folder)) nil) @@ -625,8 +660,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (defun elmo-generic-folder-open (folder load-msgdb) (let ((inhibit-quit t)) - (if load-msgdb - (elmo-folder-set-msgdb-internal folder (elmo-msgdb-load folder))) + (if load-msgdb (elmo-folder-msgdb folder)) (elmo-folder-set-killed-list-internal folder (elmo-msgdb-killed-list-load (elmo-folder-msgdb-path folder)))) @@ -714,20 +748,34 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (defsubst elmo-folder-search-fast (folder condition numbers) (when (and numbers (vectorp condition) - (member (elmo-filter-key condition) '("first" "last"))) - (let ((len (length numbers)) - (lastp (string= (elmo-filter-key condition) "last")) - (value (string-to-number (elmo-filter-value condition)))) - (when (eq (elmo-filter-type condition) 'unmatch) - (setq lastp (not lastp) - value (- len value))) - (if lastp - (nthcdr (max (- len value) 0) numbers) - (when (> value 0) - (let ((last (nthcdr (1- value) numbers))) - (when last - (setcdr last nil)) - numbers)))))) + (member (elmo-filter-key condition) '("first" "last" "mark"))) + (if (string= (elmo-filter-key condition) "mark") + (let ((msgdb (elmo-folder-msgdb folder))) + ;; msgdb should be synchronized at this point. + (cond + ((string= (elmo-filter-value condition) "unread") + (elmo-folder-list-unreads folder)) + ((string= (elmo-filter-value condition) "important") + (elmo-folder-list-importants folder)) + ((string= (elmo-filter-value condition) "answered") + (elmo-folder-list-answereds folder)) + ((string= (elmo-filter-value condition) "any") + (nconc (elmo-folder-list-unreads folder) + (elmo-folder-list-importants folder) + (elmo-folder-list-answereds folder))))) + (let ((len (length numbers)) + (lastp (string= (elmo-filter-key condition) "last")) + (value (string-to-number (elmo-filter-value condition)))) + (when (eq (elmo-filter-type condition) 'unmatch) + (setq lastp (not lastp) + value (- len value))) + (if lastp + (nthcdr (max (- len value) 0) numbers) + (when (> value 0) + (let ((last (nthcdr (1- value) numbers))) + (when last + (setcdr last nil)) + numbers))))))) (luna-define-method elmo-folder-search ((folder elmo-folder) condition @@ -954,14 +1002,13 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (luna-define-method elmo-folder-append-messages ((folder elmo-folder) src-folder numbers - unread-marks &optional same-number) (elmo-generic-folder-append-messages folder src-folder numbers - unread-marks same-number)) + same-number)) (defun elmo-generic-folder-append-messages (folder src-folder numbers - unread-marks same-number) + same-number) (let (unseen seen-list succeed-numbers failure cache) (with-temp-buffer (set-buffer-multibyte nil) @@ -995,7 +1042,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") folder (setq unseen (member (elmo-message-mark src-folder (car numbers)) - unread-marks)) + (elmo-msgdb-unread-marks))) (if same-number (car numbers)))))) (error (setq failure t))) ;; FETCH & APPEND finished @@ -1021,7 +1068,6 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") no-delete-info no-delete same-number - unread-marks save-unread) (save-excursion (let* ((messages msgs) @@ -1039,7 +1085,6 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (unless (setq succeeds (elmo-folder-append-messages dst-folder src-folder messages - unread-marks same-number)) (error "move: append message to %s failed" (elmo-folder-name-internal dst-folder))) @@ -1052,7 +1097,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (setq seen-list (elmo-msgdb-add-msgs-to-seen-list msgs (elmo-folder-msgdb src-folder) - unread-marks seen-list)) + seen-list)) (elmo-msgdb-seen-save dir seen-list)))) (if (and (not no-delete) succeeds) (progn @@ -1110,7 +1155,7 @@ FIELD is a symbol of the field." (elmo-msgdb-get-field (elmo-folder-msgdb folder) number field)) (defun elmo-message-set-mark (folder number mark) - "Set mark for the message in the FOLDER with NUMBER as MARK." + ;; Set mark for the message in the FOLDER with NUMBER as MARK. (elmo-msgdb-set-mark (elmo-folder-msgdb folder) number mark)) @@ -1121,18 +1166,55 @@ 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-unmark-important ((folder elmo-folder) numbers) - t) +(luna-define-method elmo-folder-unmark-important ((folder elmo-folder) + numbers) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-unset-status (elmo-folder-msgdb folder) + folder + number + 'important)))) (luna-define-method elmo-folder-mark-as-important ((folder elmo-folder) numbers) - t) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-set-status (elmo-folder-msgdb folder) + folder + number + 'important)))) (luna-define-method elmo-folder-unmark-read ((folder elmo-folder) numbers) - t) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-unset-status (elmo-folder-msgdb folder) + folder + number + 'read)))) (luna-define-method elmo-folder-mark-as-read ((folder elmo-folder) numbers) - t) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-set-status (elmo-folder-msgdb folder) + folder + number + 'read)))) + +(luna-define-method elmo-folder-unmark-answered ((folder elmo-folder) numbers) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-unset-status (elmo-folder-msgdb folder) + folder + number + 'answered)))) + +(luna-define-method elmo-folder-mark-as-answered ((folder elmo-folder) numbers) + (when (elmo-folder-msgdb-internal folder) + (dolist (number numbers) + (elmo-msgdb-set-status (elmo-folder-msgdb folder) + folder + number + 'answered)))) (luna-define-method elmo-folder-process-crosspost ((folder elmo-folder) &optional @@ -1140,19 +1222,6 @@ FIELD is a symbol of the field." ;; Do nothing. ) -(defsubst elmo-folder-replace-marks (folder alist) - "Replace marks of the FOLDER according to ALIST." - (let (pair) - (dolist (elem (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))) - (when (setq pair (assoc (cadr elem) alist)) - (if (elmo-message-use-cache-p folder (car elem)) - (elmo-msgdb-set-mark (elmo-folder-msgdb folder) - (car elem) - (cdr pair)) - (elmo-msgdb-set-mark (elmo-folder-msgdb folder) - (car elem) - nil)))))) - (defun elmo-generic-folder-append-msgdb (folder append-msgdb) (if append-msgdb (let* ((number-alist (elmo-msgdb-get-number-alist append-msgdb)) @@ -1164,6 +1233,10 @@ FIELD is a symbol of the field." pair overview to-be-deleted mark-alist) + (elmo-folder-set-msgdb-internal folder + (elmo-msgdb-append + (elmo-folder-msgdb folder) + append-msgdb)) (while cur (setq all-alist (delq (car cur) all-alist)) ;; same message id exists. @@ -1189,10 +1262,6 @@ FIELD is a symbol of the field." (t ;; Do nothing. (setq to-be-deleted nil))) - (elmo-folder-set-msgdb-internal folder - (elmo-msgdb-append - (elmo-folder-msgdb folder) - append-msgdb)) (length to-be-deleted)) 0)) @@ -1285,29 +1354,17 @@ FIELD is a symbol of the field." (elmo-folder-set-msgdb-internal folder (elmo-msgdb-clear))) (defun elmo-folder-synchronize (folder - new-mark ;"N" - unread-uncached-mark ;"U" - unread-cached-mark ;"!" - read-uncached-mark ;"u" - important-mark ;"$" &optional ignore-msgdb no-check) "Synchronize the folder data to the newest status. FOLDER is the ELMO folder structure. -NEW-MARK, UNREAD-CACHED-MARK, READ-UNCACHED-MARK, and IMPORTANT-MARK -are mark strings for new messages, unread but cached messages, -read but not cached messages, and important messages. If optional IGNORE-MSGDB is non-nil, current msgdb is thrown away except read mark status. If IGNORE-MSGDB is 'visible-only, only visible messages \(the messages which are not in the killed-list\) are thrown away and synchronized. If NO-CHECK is non-nil, rechecking folder is skipped. -Return a list of -\(NEW-MSGDB DELETE-LIST CROSSED\) -NEW-MSGDB is the newly appended msgdb. -DELETE-LIST is a list of deleted message number. -CROSSED is cross-posted message number. +Return a list of a cross-posted message number. If update process is interrupted, return nil." (let ((killed-list (elmo-folder-killed-list-internal folder)) (before-append t) @@ -1323,11 +1380,9 @@ If update process is interrupted, return nil." (elmo-folder-msgdb folder))) (if ignore-msgdb (progn - (setq seen-list (nconc - (elmo-msgdb-seen-list - (elmo-folder-msgdb folder) - (list important-mark read-uncached-mark)) - seen-list)) + (setq seen-list (nconc (elmo-msgdb-seen-list + (elmo-folder-msgdb folder)) + seen-list)) (elmo-folder-clear folder (eq ignore-msgdb 'visible-only)))) (unless no-check (elmo-folder-check folder)) (condition-case nil @@ -1358,19 +1413,16 @@ If update process is interrupted, return nil." (progn (elmo-folder-update-number folder) (elmo-folder-process-crosspost folder) - (list nil nil nil) ; no updates. + 0 ; no updates. ) (if delete-list (elmo-msgdb-delete-msgs (elmo-folder-msgdb folder) delete-list)) (when new-list (setq new-msgdb (elmo-folder-msgdb-create - folder - new-list - new-mark unread-cached-mark - read-uncached-mark important-mark - seen-list)) + folder new-list seen-list)) (elmo-msgdb-change-mark (elmo-folder-msgdb folder) - new-mark unread-uncached-mark) + elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark) ;; Clear seen-list. (if (elmo-folder-persistent-p folder) (setq seen-list (elmo-msgdb-seen-save @@ -1383,7 +1435,7 @@ If update process is interrupted, return nil." (elmo-folder-set-message-modified-internal folder t) (elmo-folder-set-mark-modified-internal folder t)) ;; return value. - (list new-msgdb delete-list crossed))) + (or crossed 0))) (quit ;; Resume to the original status. (if before-append @@ -1397,7 +1449,6 @@ If update process is interrupted, return nil." (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder)))) -;;; (defun elmo-msgdb-load (folder &optional silent) (unless silent (message "Loading msgdb for %s..." (elmo-folder-name-internal folder))) diff --git a/wl/wl-expire.el b/wl/wl-expire.el index 165e07e..d3f2b94 100644 --- a/wl/wl-expire.el +++ b/wl/wl-expire.el @@ -149,7 +149,6 @@ t copy preserve-number - nil wl-expire-add-seen-list) (progn (wl-expire-append-log @@ -205,7 +204,6 @@ If REFILE-LIST includes reserve mark message, so copy." t copy-reserve-message preserve-number - nil wl-expire-add-seen-list)) (error "Expire: move msgs to %s failed" (elmo-folder-name-internal dst-folder))) @@ -813,7 +811,7 @@ ex. +ml/wl/1999_11/, +ml/wl/1999_12/." (interactive "P") (let* ((folder (or folder wl-summary-buffer-elmo-folder)) (msgdb (or (wl-summary-buffer-msgdb) - (elmo-msgdb-load folder))) + (elmo-folder-msgdb folder))) (msgs (if (not nolist) (elmo-folder-list-messages folder) (mapcar 'car (elmo-msgdb-get-number-alist msgdb)))) diff --git a/wl/wl-folder.el b/wl/wl-folder.el index ea911f4..4099f3b 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -816,19 +816,20 @@ Optional argument ARG is repeart count." (defun wl-folder-check-one-entity (entity &optional biff) (let* ((folder (wl-folder-get-elmo-folder entity biff)) - (nums (condition-case err + (nums ;(condition-case err (progn (if biff (elmo-folder-set-biff-internal folder t)) (if (wl-string-match-member entity wl-strict-diff-folders) (elmo-strict-folder-diff folder) (elmo-folder-diff folder))) - (error + ; (error ;; maybe not exist folder. - (if (and (not (memq 'elmo-open-error - (get (car err) 'error-conditions))) - (not (elmo-folder-exists-p folder))) - (wl-folder-create-subr folder) - (signal (car err) (cdr err)))))) + ; (if (and (not (memq 'elmo-open-error + ; (get (car err) 'error-conditions))) + ; (not (elmo-folder-exists-p folder))) + ; (wl-folder-create-subr folder) + ; (signal (car err) (cdr err)))))) + ) (new (elmo-diff-new nums)) (unread (elmo-diff-unread nums)) (all (elmo-diff-all nums)) diff --git a/wl/wl-highlight.el b/wl/wl-highlight.el index 4391cf5..9cbfd21 100644 --- a/wl/wl-highlight.el +++ b/wl/wl-highlight.el @@ -777,14 +777,14 @@ (defun wl-highlight-summary-line-string (line mark temp-mark indent) (let (fsymbol) (cond ((and (string= temp-mark "+") - (member mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark))) + (member mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-new-mark))) (setq fsymbol 'wl-highlight-summary-high-unread-face)) ((and (string= temp-mark "-") - (member mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark))) + (member mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-new-mark))) (setq fsymbol 'wl-highlight-summary-low-unread-face)) ((string= temp-mark "o") (setq fsymbol 'wl-highlight-summary-refiled-face)) @@ -794,12 +794,12 @@ (setq fsymbol 'wl-highlight-summary-deleted-face)) ((string= temp-mark "*") (setq fsymbol 'wl-highlight-summary-temp-face)) - ((string= mark wl-summary-new-mark) + ((string= mark elmo-msgdb-new-mark) (setq fsymbol 'wl-highlight-summary-new-face)) - ((member mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark)) + ((member mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark)) (setq fsymbol 'wl-highlight-summary-unread-face)) - ((or (string= mark wl-summary-important-mark)) + ((or (string= mark elmo-msgdb-important-mark)) (setq fsymbol 'wl-highlight-summary-important-face)) ((string= temp-mark "-") (setq fsymbol 'wl-highlight-summary-low-read-face)) @@ -842,21 +842,21 @@ (if (not fsymbol) (cond ((and (string= temp-mark "+") - (member status-mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark))) + (member status-mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-new-mark))) (setq fsymbol 'wl-highlight-summary-high-unread-face)) ((and (string= temp-mark "-") - (member status-mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark))) + (member status-mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-new-mark))) (setq fsymbol 'wl-highlight-summary-low-unread-face)) - ((string= status-mark wl-summary-new-mark) + ((string= status-mark elmo-msgdb-new-mark) (setq fsymbol 'wl-highlight-summary-new-face)) - ((member status-mark (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark)) + ((member status-mark (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark)) (setq fsymbol 'wl-highlight-summary-unread-face)) - ((string= status-mark wl-summary-important-mark) + ((string= status-mark elmo-msgdb-important-mark) (setq fsymbol 'wl-highlight-summary-important-face)) ;; score mark ((string= temp-mark "-") diff --git a/wl/wl-summary.el b/wl/wl-summary.el index cd546eb..3c6bd28 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -83,6 +83,7 @@ (defvar wl-summary-buffer-current-msg nil) (defvar wl-summary-buffer-unread-count 0) (defvar wl-summary-buffer-new-count 0) +(defvar wl-summary-buffer-answered-count 0) (defvar wl-summary-buffer-mime-charset nil) (defvar wl-summary-buffer-weekday-name-lang nil) (defvar wl-summary-buffer-thread-indent-set-alist nil) @@ -147,6 +148,7 @@ (make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg) (make-variable-buffer-local 'wl-summary-buffer-unread-count) (make-variable-buffer-local 'wl-summary-buffer-new-count) +(make-variable-buffer-local 'wl-summary-buffer-answered-count) (make-variable-buffer-local 'wl-summary-buffer-mime-charset) (make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang) (make-variable-buffer-local 'wl-summary-buffer-thread-indent-set) @@ -195,11 +197,6 @@ (defvar wl-temp-mark) (defvar wl-persistent-mark) -;; internal functions (dummy) -(unless (fboundp 'wl-summary-append-message-func-internal) - (defun wl-summary-append-message-func-internal (entity msgdb update - &optional force-insert))) - (defmacro wl-summary-sticky-buffer-name (name) (` (concat wl-summary-buffer-name ":" (, name)))) @@ -573,15 +570,12 @@ See also variable `wl-use-petname'." (wl-summary-redisplay))) (defun wl-summary-count-unread () - (let ((pair - (elmo-msgdb-count-marks (wl-summary-buffer-msgdb) - wl-summary-new-mark - (list wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark)))) + (let ((lst (elmo-msgdb-count-marks (wl-summary-buffer-msgdb)))) (if (eq major-mode 'wl-summary-mode) - (setq wl-summary-buffer-new-count (car pair) - wl-summary-buffer-unread-count (cdr pair))) - pair)) + (setq wl-summary-buffer-new-count (car lst) + wl-summary-buffer-unread-count (nth 1 lst) + wl-summary-buffer-answered-count (nth 2 lst))) + lst)) (defun wl-summary-message-string (&optional use-cache) "Return full body string of current message. @@ -951,8 +945,6 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (inhibit-read-only t) (buffer-read-only nil) expunged) - (fset 'wl-summary-append-message-func-internal - (wl-summary-get-append-message-func)) (erase-buffer) (message "Re-scanning...") (setq i 0) @@ -979,7 +971,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (elmo-kill-buffer wl-summary-search-buf-name) (while curp (setq entity (car curp)) - (wl-summary-append-message-func-internal entity msgdb nil) + (wl-summary-insert-message entity msgdb nil) (setq curp (cdr curp)) (when (> num elmo-display-progress-threshold) (setq i (+ i 1)) @@ -993,7 +985,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (caar wl-summary-delayed-update) (elmo-msgdb-overview-entity-get-number (cdar wl-summary-delayed-update))) - (wl-summary-append-message-func-internal + (wl-summary-insert-message (cdar wl-summary-delayed-update) msgdb nil t) (setq wl-summary-delayed-update (cdr wl-summary-delayed-update)))) (message "Constructing summary structure...done") @@ -1002,8 +994,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (progn (message "Inserting thread...") (wl-thread-insert-top) - (message "Inserting thread...done")) - (wl-summary-make-number-list)) + (message "Inserting thread...done"))) (when wl-use-scoring (setq wl-summary-scored nil) (wl-summary-score-headers nil msgdb @@ -1437,15 +1428,15 @@ If ARG is non-nil, checking is omitted." (setq new-mark (cond ((string= mark - wl-summary-unread-uncached-mark) - wl-summary-unread-cached-mark) - ((string= mark wl-summary-new-mark) + elmo-msgdb-unread-uncached-mark) + elmo-msgdb-unread-cached-mark) + ((string= mark elmo-msgdb-new-mark) (setq wl-summary-buffer-new-count (- wl-summary-buffer-new-count 1)) (setq wl-summary-buffer-unread-count (+ wl-summary-buffer-unread-count 1)) - wl-summary-unread-cached-mark) - ((string= mark wl-summary-read-uncached-mark) + elmo-msgdb-unread-cached-mark) + ((string= mark elmo-msgdb-read-uncached-mark) nil) (t mark))) (elmo-msgdb-set-mark msgdb number new-mark) @@ -1459,9 +1450,9 @@ If ARG is non-nil, checking is omitted." new-mark))))))) ;;(defvar wl-summary-message-uncached-marks -;; (list wl-summary-new-mark -;; wl-summary-unread-uncached-mark -;; wl-summary-read-uncached-mark)) +;; (list elmo-msgdb-new-mark +;; elmo-msgdb-unread-uncached-mark +;; elmo-msgdb-read-uncached-mark)) (defun wl-summary-prefetch-region (beg end &optional prefetch-marks) (interactive "r") @@ -1508,8 +1499,8 @@ If ARG is non-nil, checking is omitted." (wl-summary-prefetch)) (wl-summary-prefetch-msg (car targets)))) (if (if prefetch-marks - (string= mark wl-summary-unread-cached-mark) - (or (string= mark wl-summary-unread-cached-mark) + (string= mark elmo-msgdb-unread-cached-mark) + (or (string= mark elmo-msgdb-unread-cached-mark) (string= mark " "))) (message "Prefetching... %d/%d message(s)" (setq count (+ 1 count)) length)) @@ -1682,39 +1673,36 @@ If ARG is non-nil, checking is omitted." (message "Setting all msgs as read...") (elmo-folder-mark-as-read folder (elmo-folder-list-unreads - folder - (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark))) + folder)) (save-excursion (goto-char (point-min)) (while (not (eobp)) (setq msg (wl-summary-message-number)) (setq mark (wl-summary-persistent-mark)) (when (and (not (string= mark " ")) - (not (string= mark wl-summary-important-mark)) - (not (string= mark wl-summary-read-uncached-mark))) + (not (string= mark elmo-msgdb-important-mark)) + (not (string= mark elmo-msgdb-read-uncached-mark))) (delete-backward-char 1) (if (or (not (elmo-message-use-cache-p folder msg)) - (string= mark wl-summary-unread-cached-mark)) + (string= mark elmo-msgdb-unread-cached-mark)) (progn (insert " ") (elmo-msgdb-set-mark msgdb msg nil)) ;; New mark and unread-uncached mark - (insert wl-summary-read-uncached-mark) + (insert elmo-msgdb-read-uncached-mark) (elmo-msgdb-set-mark - msgdb msg wl-summary-read-uncached-mark)) + msgdb msg elmo-msgdb-read-uncached-mark)) (if wl-summary-highlight (wl-highlight-summary-current-line nil nil t))) (forward-line 1))) - (elmo-folder-replace-marks - folder - (list (cons wl-summary-unread-cached-mark - nil) - (cons wl-summary-unread-uncached-mark - wl-summary-read-uncached-mark) - (cons wl-summary-new-mark - wl-summary-read-uncached-mark))) +; (elmo-folder-replace-marks +; folder +; (list (cons elmo-msgdb-unread-cached-mark +; nil) +; (cons elmo-msgdb-unread-uncached-mark +; elmo-msgdb-read-uncached-mark) +; (cons elmo-msgdb-new-mark +; elmo-msgdb-read-uncached-mark))) (wl-summary-set-mark-modified) (wl-folder-update-unread (wl-summary-buffer-folder-name) 0) (setq wl-summary-buffer-unread-count 0) @@ -1736,15 +1724,15 @@ If ARG is non-nil, checking is omitted." mark number unread new-mark) (setq mark (wl-summary-persistent-mark)) (cond - ((or (string= mark wl-summary-new-mark) - (string= mark wl-summary-unread-uncached-mark) - (string= mark wl-summary-important-mark)) + ((or (string= mark elmo-msgdb-new-mark) + (string= mark elmo-msgdb-unread-uncached-mark) + (string= mark elmo-msgdb-important-mark)) ;; noop ) - ((string= mark wl-summary-unread-cached-mark) - (setq new-mark wl-summary-unread-uncached-mark)) + ((string= mark elmo-msgdb-unread-cached-mark) + (setq new-mark elmo-msgdb-unread-uncached-mark)) (t - (setq new-mark wl-summary-read-uncached-mark))) + (setq new-mark elmo-msgdb-read-uncached-mark))) (when new-mark (setq number (wl-summary-message-number)) (delete-backward-char 1) @@ -1781,16 +1769,16 @@ If ARG is non-nil, checking is omitted." (setq set-mark nil) (if (elmo-file-cache-exists-p msgid) (if (or - (string= mark wl-summary-unread-uncached-mark) ; U -> ! - (string= mark wl-summary-new-mark) ; N -> ! + (string= mark elmo-msgdb-unread-uncached-mark) ; U -> ! + (string= mark elmo-msgdb-new-mark) ; N -> ! ) - (setq set-mark wl-summary-unread-cached-mark) - (if (string= mark wl-summary-read-uncached-mark) ; u -> ' ' + (setq set-mark elmo-msgdb-unread-cached-mark) + (if (string= mark elmo-msgdb-read-uncached-mark) ; u -> ' ' (setq set-mark " "))) (if (string= mark " ") - (setq set-mark wl-summary-read-uncached-mark) ;' ' -> u - (if (string= mark wl-summary-unread-cached-mark) - (setq set-mark wl-summary-unread-uncached-mark) ; ! -> U + (setq set-mark elmo-msgdb-read-uncached-mark) ;' ' -> u + (if (string= mark elmo-msgdb-unread-cached-mark) + (setq set-mark elmo-msgdb-unread-uncached-mark) ; ! -> U ))) (when set-mark (delete-backward-char 1) @@ -1864,6 +1852,25 @@ If ARG is non-nil, checking is omitted." (wl-highlight-summary-current-line))) (forward-line 1))))) +(defun wl-summary-update-status-marks () + "Synchronize status marks on current buffer to the msgdb." + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((inhibit-read-only t) + (buffer-read-only nil) + mark) + (while (not (eobp)) + (unless (string= (wl-summary-persistent-mark) + (setq mark (or (elmo-message-mark + wl-summary-buffer-elmo-folder + (wl-summary-message-number)) + " "))) + (delete-backward-char 1) + (insert mark) + (if wl-summary-highlight (wl-highlight-summary-current-line))) + (forward-line 1))))) + (defun wl-summary-get-delete-folder (folder) (if (string= folder wl-trash-folder) 'null @@ -1883,10 +1890,10 @@ If ARG is non-nil, checking is omitted." (error "Trash Folder is not created")))) wl-trash-folder))))) -(defun wl-summary-get-append-message-func () +(defun wl-summary-insert-message (&rest args) (if (eq wl-summary-buffer-view 'thread) - 'wl-summary-insert-thread-entity - 'wl-summary-insert-sequential)) + (apply 'wl-summary-insert-thread-entity args) + (apply 'wl-summary-insert-sequential args))) (defun wl-summary-sort () (interactive) @@ -1902,8 +1909,9 @@ If ARG is non-nil, checking is omitted." "Update marks in summary." (interactive) (let ((last-progress 0) + (folder wl-summary-buffer-elmo-folder) (i 0) - unread-marks importants unreads + importants unreads importants-in-db unreads-in-db diff diffs mes progress) ;; synchronize marks. @@ -1911,27 +1919,22 @@ If ARG is non-nil, checking is omitted." wl-summary-buffer-elmo-folder) 'internal)) (message "Updating marks...") - (setq unread-marks (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark) - importants-in-db (elmo-folder-list-messages-mark-match + (setq importants-in-db (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (regexp-quote wl-summary-important-mark)) + (regexp-quote elmo-msgdb-important-mark)) unreads-in-db (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (wl-regexp-opt unread-marks)) + (wl-regexp-opt (elmo-msgdb-unread-marks))) importants (elmo-folder-list-importants - wl-summary-buffer-elmo-folder - wl-summary-important-mark) + wl-summary-buffer-elmo-folder) unreads (elmo-folder-list-unreads - wl-summary-buffer-elmo-folder - unread-marks)) + wl-summary-buffer-elmo-folder)) (setq diff (elmo-list-diff importants importants-in-db)) (setq diffs (cadr diff)) ; important-deletes (setq mes (format "Updated (-%d" (length diffs))) (while diffs (wl-summary-mark-as-important (car diffs) - wl-summary-important-mark + elmo-msgdb-important-mark 'no-server) (setq diffs (cdr diffs))) (setq diffs (car diff)) ; important-appends @@ -1962,34 +1965,22 @@ If ARG is non-nil, checking is omitted." (buffer-read-only nil) gc-message overview number-alist - curp num i new-msgdb + curp num i diff append-list delete-list crossed update-thread update-top-list - expunged mes sync-result entity) + expunged mes entity) (unwind-protect (progn (unless wl-summary-buffer-elmo-folder (error "(Internal error) Folder is not set:%s" (buffer-name (current-buffer)))) - (fset 'wl-summary-append-message-func-internal - (wl-summary-get-append-message-func)) ;; Flush pending append operations (disconnected operation). ;;(setq seen-list ;;(wl-summary-flush-pending-append-operations seen-list)) (goto-char (point-max)) (wl-folder-confirm-existence folder (elmo-folder-plugged-p folder)) - (setq sync-result (elmo-folder-synchronize - folder - wl-summary-new-mark - wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark - wl-summary-read-uncached-mark - wl-summary-important-mark - sync-all no-check)) - (setq new-msgdb (nth 0 sync-result)) - (setq delete-list (nth 1 sync-result)) - (setq crossed (nth 2 sync-result)) - (if sync-result + (setq crossed (elmo-folder-synchronize folder sync-all no-check)) + (if crossed (progn ;; Setup sync-all (if sync-all (wl-summary-sync-all-init)) @@ -2000,19 +1991,24 @@ If ARG is non-nil, checking is omitted." ; (wl-summary-delete-canceled-msgs-from-list ; delete-list ; (wl-summary-buffer-msgdb)))) + (setq diff (elmo-list-diff (elmo-folder-list-messages + folder + 'visible-only + 'in-msgdb) + wl-summary-buffer-number-list)) + (setq append-list (car diff)) + (setq delete-list (cadr diff)) + (when delete-list - (wl-summary-delete-messages-on-buffer delete-list "Deleting...") + (wl-summary-delete-messages-on-buffer + delete-list "Deleting...") (message "Deleting...done")) - (when new-msgdb - (wl-summary-replace-status-marks - wl-summary-new-mark - wl-summary-unread-uncached-mark)) - (setq append-list (elmo-msgdb-get-overview new-msgdb)) + (wl-summary-update-status-marks) (setq curp append-list) (setq num (length curp)) (when append-list (setq i 0) - + ;; set these value for append-message-func (setq overview (elmo-msgdb-get-overview (elmo-folder-msgdb folder))) @@ -2022,9 +2018,10 @@ If ARG is non-nil, checking is omitted." (setq wl-summary-delayed-update nil) (elmo-kill-buffer wl-summary-search-buf-name) (while curp - (setq entity (car curp)) + (setq entity (elmo-msgdb-overview-get-entity + (car curp) (elmo-folder-msgdb folder))) (when (setq update-thread - (wl-summary-append-message-func-internal + (wl-summary-insert-message entity (elmo-folder-msgdb folder) (not sync-all))) (wl-append update-top-list update-thread)) @@ -2037,7 +2034,10 @@ If ARG is non-nil, checking is omitted." (setq i (+ i 1)) (if (or (zerop (% i 5)) (= i num)) (elmo-display-progress - 'wl-summary-sync-update "Updating thread..." + 'wl-summary-sync-update + (if (eq wl-summary-buffer-view 'thread) + "Making thread..." + "Inserting message...") (/ (* i 100) num))))) (when wl-summary-delayed-update (while wl-summary-delayed-update @@ -2046,7 +2046,7 @@ If ARG is non-nil, checking is omitted." (elmo-msgdb-overview-entity-get-number (cdar wl-summary-delayed-update))) (when (setq update-thread - (wl-summary-append-message-func-internal + (wl-summary-insert-message (cdar wl-summary-delayed-update) (elmo-folder-msgdb folder) (not sync-all) t)) @@ -2057,16 +2057,16 @@ If ARG is non-nil, checking is omitted." update-top-list) (wl-thread-update-indent-string-thread (elmo-uniq-list update-top-list))) - (message "Updating thread...done")) - (unless (eq wl-summary-buffer-view 'thread) - (wl-summary-make-number-list)) + (message (if (eq wl-summary-buffer-view 'thread) + "Making thread...done" + "Inserting message...done"))) (wl-summary-set-message-modified) (wl-summary-set-mark-modified) (when (and sync-all (eq wl-summary-buffer-view 'thread)) (elmo-kill-buffer wl-summary-search-buf-name) - (message "Inserting thread...") + (message "Inserting message...") (wl-thread-insert-top) - (message "Inserting thread...done")) + (message "Inserting message...done")) (if elmo-use-database (elmo-database-close)) (run-hooks 'wl-summary-sync-updated-hook) @@ -2080,7 +2080,7 @@ If ARG is non-nil, checking is omitted." (length delete-list) num)))) (setq mes "Quit updating."))) ;; synchronize marks. - (if (and wl-summary-auto-sync-marks sync-result) + (if (and crossed wl-summary-auto-sync-marks) (wl-summary-sync-marks)) ;; scoring (when wl-use-scoring @@ -2105,8 +2105,8 @@ If ARG is non-nil, checking is omitted." (wl-folder-set-folder-updated (elmo-folder-name-internal folder) (list 0 - (let ((pair (wl-summary-count-unread))) - (+ (car pair) (cdr pair))) + (let ((lst (wl-summary-count-unread))) + (+ (car lst) (nth 1 lst))) (elmo-folder-messages folder))) (wl-summary-update-modeline) ;; @@ -2383,10 +2383,15 @@ If ARG, without confirm." (get-buffer-create wl-summary-buffer-name)))) (defun wl-summary-make-number-list () - (setq wl-summary-buffer-number-list - (mapcar - (lambda (x) (elmo-msgdb-overview-entity-get-number x)) - (elmo-msgdb-get-overview (wl-summary-buffer-msgdb))))) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (setq wl-summary-buffer-number-list + (cons (wl-summary-message-number) + wl-summary-buffer-number-list)) + (forward-line 1)) + (setq wl-summary-buffer-number-list + (nreverse wl-summary-buffer-number-list)))) (defun wl-summary-auto-select-msg-p (unread-msg) (and unread-msg @@ -2394,7 +2399,7 @@ If ARG, without confirm." (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) unread-msg) - wl-summary-important-mark)))) + elmo-msgdb-important-mark)))) (defsubst wl-summary-open-folder (folder) ;; Select folder @@ -2640,7 +2645,11 @@ If ARG, without confirm." (elmo-msgdb-get-mark msgdb (elmo-msgdb-overview-entity-get-number - entity)))))) + entity)))) + (setq wl-summary-buffer-number-list + (wl-append wl-summary-buffer-number-list + (list (elmo-msgdb-overview-entity-get-number entity)))) + nil)) (defun wl-summary-default-subject-filter (subject) (let ((case-fold-search t)) @@ -2852,7 +2861,7 @@ If ARG, without confirm." (folder wl-summary-buffer-elmo-folder) (msgdb (wl-summary-buffer-msgdb)) ;;; (number-alist (elmo-msgdb-get-number-alist msgdb)) - new-mark visible mark cur-mark) + new-mark visible mark cur-mark entity) (if number (progn (setq visible (wl-summary-jump-to-msg number)) @@ -2873,22 +2882,20 @@ If ARG, without confirm." ;; visible. (setq cur-mark (wl-summary-persistent-mark)) (or (string= cur-mark " ") - (string= cur-mark wl-summary-read-uncached-mark)))) + (string= cur-mark elmo-msgdb-read-uncached-mark)))) (progn (setq number (or number (wl-summary-message-number))) (setq mark (or mark cur-mark)) (save-match-data (setq new-mark (if (string= mark - wl-summary-read-uncached-mark) - wl-summary-unread-uncached-mark + elmo-msgdb-read-uncached-mark) + elmo-msgdb-unread-uncached-mark (if (elmo-message-use-cache-p folder number) - wl-summary-unread-mark - wl-summary-unread-uncached-mark)))) + elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark)))) ;; server side mark (unless no-server-update - (save-match-data - (unless (elmo-folder-unmark-read folder (list number)) - (error "Setting mark failed")))) + (elmo-folder-unmark-read folder (list number))) (when visible (delete-backward-char 1) (insert new-mark)) @@ -3024,9 +3031,9 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (let ((del-fld (wl-summary-get-delete-folder (wl-summary-buffer-folder-name))) (start (point)) - (unread-marks (list wl-summary-unread-cached-mark - wl-summary-unread-uncached-mark - wl-summary-new-mark)) + (unread-marks (list elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-new-mark)) (refiles (append moves dels)) (refile-failures 0) (copy-failures 0) @@ -3065,7 +3072,6 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (not (null (cdr dst-msgs))) nil ; no-delete nil ; same-number - unread-marks t)) (error nil)) (if result ; succeeded. @@ -3098,7 +3104,6 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (not (null (cdr dst-msgs))) t ; t is no-delete (copy) nil ; same number - unread-marks t)) (error nil)) (if result ; succeeded. @@ -4002,13 +4007,13 @@ If ARG, exit virtual folder." t) mark (elmo-msgdb-get-mark msgdb number)) (cond - ((string= mark wl-summary-new-mark) ; N + ((string= mark elmo-msgdb-new-mark) ; N (setq stat 'new)) - ((string= mark wl-summary-unread-uncached-mark) ; U + ((string= mark elmo-msgdb-unread-uncached-mark) ; U (setq stat 'unread)) - ((string= mark wl-summary-unread-cached-mark) ; ! + ((string= mark elmo-msgdb-unread-cached-mark) ; ! (setq stat 'unread)) - ((string= mark wl-summary-read-uncached-mark) ; u + ((string= mark elmo-msgdb-read-uncached-mark) ; u (setq stat 'read)) (t ;; no need to mark server. @@ -4019,35 +4024,34 @@ If ARG, exit virtual folder." (not (elmo-file-cache-exists-p (elmo-message-field wl-summary-buffer-elmo-folder number 'message-id)))) - wl-summary-read-uncached-mark + elmo-msgdb-read-uncached-mark nil)) ;; folder mark. (unless no-folder-mark - (setq marked (elmo-folder-mark-as-read folder (list number)))) - (when (or no-folder-mark marked) - (cond ((eq stat 'unread) - (setq wl-summary-buffer-unread-count - (1- wl-summary-buffer-unread-count))) - ((eq stat 'new) - (setq wl-summary-buffer-new-count - (1- wl-summary-buffer-new-count)))) - (wl-summary-update-modeline) - (wl-folder-update-unread - (wl-summary-buffer-folder-name) - (+ wl-summary-buffer-unread-count - wl-summary-buffer-new-count)) - (when stat - ;; set mark on buffer - (when visible - (unless (string= (wl-summary-persistent-mark) new-mark) - (delete-backward-char 1) - (insert (or new-mark " ")))) - ;; set msgdb mark. - (unless (string= mark new-mark) - (elmo-msgdb-set-mark msgdb number new-mark)) - (wl-summary-set-mark-modified)) - (if (and visible wl-summary-highlight) - (wl-highlight-summary-current-line nil nil t))) + (elmo-folder-mark-as-read folder (list number))) + (cond ((eq stat 'unread) + (setq wl-summary-buffer-unread-count + (1- wl-summary-buffer-unread-count))) + ((eq stat 'new) + (setq wl-summary-buffer-new-count + (1- wl-summary-buffer-new-count)))) + (wl-summary-update-modeline) + (wl-folder-update-unread + (wl-summary-buffer-folder-name) + (+ wl-summary-buffer-unread-count + wl-summary-buffer-new-count)) + (when stat + ;; set mark on buffer + (when visible + (unless (string= (wl-summary-persistent-mark) new-mark) + (delete-backward-char 1) + (insert (or new-mark " ")))) + ;; set msgdb mark. + (unless (string= mark new-mark) + (elmo-msgdb-set-mark msgdb number new-mark)) + (wl-summary-set-mark-modified)) + (if (and visible wl-summary-highlight) + (wl-highlight-summary-current-line nil nil t)) (set-buffer-modified-p nil) (if stat (run-hooks 'wl-summary-unread-message-hook)) @@ -4093,7 +4097,7 @@ If ARG, exit virtual folder." wl-summary-buffer-elmo-folder number 'message-id)) - (if (string= mark wl-summary-important-mark) + (if (string= mark elmo-msgdb-important-mark) (progn ;; server side mark (save-match-data @@ -4116,16 +4120,16 @@ If ARG, exit virtual folder." (elmo-folder-mark-as-important folder (list number)))) (when visible (delete-backward-char 1) - (insert wl-summary-important-mark)) + (insert elmo-msgdb-important-mark)) (elmo-msgdb-set-mark msgdb number - wl-summary-important-mark) + elmo-msgdb-important-mark) (if (eq (elmo-file-cache-exists-p message-id) 'entire) (elmo-folder-mark-as-read folder (list number)) ;; Force cache message. (elmo-message-encache folder number 'read)) (unless no-server-update (elmo-msgdb-global-mark-set message-id - wl-summary-important-mark))) + elmo-msgdb-important-mark))) (wl-summary-set-mark-modified))) (if (and visible wl-summary-highlight) (wl-highlight-summary-current-line nil nil t)))) @@ -4297,25 +4301,25 @@ If ARG, exit virtual folder." (defvar wl-summary-move-spec-plugged-alist (` ((new . ((t . nil) - (p . (, wl-summary-new-mark)) + (p . (, elmo-msgdb-new-mark)) (p . (, (wl-regexp-opt - (list wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark)))) - (p . (, (regexp-quote wl-summary-important-mark))))) + (list elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark)))) + (p . (, (regexp-quote elmo-msgdb-important-mark))))) (unread . ((t . nil) (p . (, (wl-regexp-opt - (list wl-summary-new-mark - wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark)))) - (p . (, (regexp-quote wl-summary-important-mark)))))))) + (list elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark)))) + (p . (, (regexp-quote elmo-msgdb-important-mark)))))))) (defvar wl-summary-move-spec-unplugged-alist (` ((new . ((t . nil) - (p . (, wl-summary-unread-cached-mark)) - (p . (, (regexp-quote wl-summary-important-mark))))) + (p . (, elmo-msgdb-unread-cached-mark)) + (p . (, (regexp-quote elmo-msgdb-important-mark))))) (unread . ((t . nil) - (p . (, wl-summary-unread-cached-mark)) - (p . (, (regexp-quote wl-summary-important-mark)))))))) + (p . (, elmo-msgdb-unread-cached-mark)) + (p . (, (regexp-quote elmo-msgdb-important-mark)))))))) (defsubst wl-summary-next-message (num direction hereto) (if wl-summary-buffer-next-message-function @@ -5024,8 +5028,8 @@ Use function list is `wl-summary-write-current-folder-functions'." () (setq skip-pmark-regexp (wl-regexp-opt (list " " - wl-summary-unread-cached-mark - wl-summary-important-mark)))) + elmo-msgdb-unread-cached-mark + elmo-msgdb-important-mark)))) (while (and skip (not (if downward (eobp) (bobp)))) (if downward diff --git a/wl/wl-thread.el b/wl/wl-thread.el index 5e5bca3..c9ca3d6 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -100,7 +100,7 @@ msgs-stack children) (while msgs (setq wl-summary-buffer-number-list (cons (car entity) - wl-summary-buffer-number-list)) + wl-summary-buffer-number-list)) (setq msgs (cdr msgs)) (setq children (wl-thread-entity-get-children entity)) (if children @@ -362,10 +362,10 @@ ENTITY is returned." (interactive) (dolist (number (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (wl-regexp-opt (list wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark - wl-summary-new-mark - wl-summary-important-mark)))) + (wl-regexp-opt (list elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark + elmo-msgdb-new-mark + elmo-msgdb-important-mark)))) (wl-thread-entity-force-open (wl-thread-get-entity number)))) (defsubst wl-thread-maybe-get-children-num (msg) @@ -737,9 +737,9 @@ Message is inserted to the summary buffer." (setq cur-mark (elmo-msgdb-get-mark msgdb msg)) (elmo-msgdb-set-mark msgdb msg - (if (string= cur-mark wl-summary-important-mark) + (if (string= cur-mark elmo-msgdb-important-mark) nil - wl-summary-important-mark)) + elmo-msgdb-important-mark)) (wl-summary-set-mark-modified))) (defun wl-thread-mark-as-read (&optional arg) @@ -831,7 +831,7 @@ Message is inserted to the summary buffer." (setq cur (1+ cur)) (if (or (zerop (% cur 2)) (= cur len)) (elmo-display-progress - 'wl-thread-insert-top "Inserting thread..." + 'wl-thread-insert-top "Inserting message..." (/ (* cur 100) len))))))) (defsubst wl-thread-insert-entity-sub (indent entity parent-entity all) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index d1f1b3c..a9baff0 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -905,34 +905,11 @@ Default is for 'followup-to-me'." :type 'boolean :group 'wl-folder) -(defcustom wl-summary-unread-mark "!" - "Mark for unread message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) -(defcustom wl-summary-important-mark "$" - "Mark for important message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) -(defcustom wl-summary-new-mark "N" - "Mark for new message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) -(defcustom wl-summary-unread-uncached-mark "U" - "Mark for unread and uncached message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) -(defcustom wl-summary-unread-cached-mark "!" - "Mark for unread but already cached message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) -(defcustom wl-summary-read-uncached-mark "u" - "Mark for read but uncached message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) (defcustom wl-summary-score-over-mark "+" "Score mark used for messages with high scores." :type '(string :tag "Mark") :group 'wl-summary-marks) + (defcustom wl-summary-score-below-mark "-" "Score mark used for messages with low scores." :type '(string :tag "Mark") @@ -988,7 +965,7 @@ This variable is local to the summary buffers." :group 'wl-score) (defcustom wl-summary-score-marks - (list wl-summary-new-mark) + (list elmo-msgdb-new-mark) "Persistent marks to scoring." :type '(repeat (string :tag "Mark")) :group 'wl-score) @@ -1705,9 +1682,9 @@ This wrapper is generated by the mail system when rejecting a letter." :group 'wl-pref) (defcustom wl-summary-auto-refile-skip-marks - (list wl-summary-new-mark - wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark) + (list elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark) "Persistent marks to skip auto-refiling." :type '(repeat (string :tag "Mark")) :group 'wl-summary) @@ -1727,8 +1704,8 @@ the message is skipped at cursor move." :group 'wl-summary) (defcustom wl-summary-incorporate-marks - (list wl-summary-new-mark - wl-summary-unread-uncached-mark) + (list elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark) "Persistent marks to prefetch at `wl-summary-incorporate'." :type '(repeat (string :tag "Mark")) :group 'wl-summary) @@ -2313,11 +2290,10 @@ ex. :group 'wl-expire) (defcustom wl-summary-expire-reserve-marks - (list wl-summary-important-mark - wl-summary-new-mark - wl-summary-unread-mark - wl-summary-unread-uncached-mark - wl-summary-unread-cached-mark) + (list elmo-msgdb-important-mark + elmo-msgdb-new-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-unread-cached-mark) "Permanent marks of reserved message when expire. Don't reserve temporary mark message. -- 1.7.10.4