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
(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
(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))
(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
;;; 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
(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))))
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)
(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)))
(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
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
(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))
'(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")
(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")))
(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
;;; 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)
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
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)
;; 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)
(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))
;;
;; 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
(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
((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))))
(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)
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)
(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
(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
((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)
(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))
(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))
(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))
(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
(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)
(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))
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))
(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)
(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)
folder))
(elmo-map-folder-location-alist-internal folder))))
t) ; success
-
(require 'product)
(product-provide (provide 'elmo-map) (require 'elmo-version))
(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
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)
(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."
(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."
;;;
;; 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)
(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)))
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)
(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
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
(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))))))
(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)
(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))
(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))
((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)
(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)
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)
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)
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))
(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))
(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))
("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
(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))))
(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
ret-val
(elmo-nntp-create-msgdb-from-overview-string
ov-str
- new-mark
- already-mark
- seen-mark
- important-mark
seen-list
filter
)))))
'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
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
(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)
;; 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)
(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
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))
(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)
(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))
(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)
(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)))))))
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*")))
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
(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
(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
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
(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))
(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))
(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))))
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))
(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
(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.
(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)
;; 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)
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)
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).
(luna-define-generic elmo-folder-append-messages (folder
src-folder
numbers
- unread-marks
&optional
same-number)
"Append messages from folder.
(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).")
((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."
(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)
(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))))
(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
(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)
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
no-delete-info
no-delete
same-number
- unread-marks
save-unread)
(save-excursion
(let* ((messages msgs)
(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)))
(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
(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))
(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
;; 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))
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.
(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))
(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)
(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
(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
(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
(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)))
t
copy
preserve-number
- nil
wl-expire-add-seen-list)
(progn
(wl-expire-append-log
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)))
(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))))
(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))
(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))
(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))
(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 "-")
(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)
(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)
(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))))
(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.
(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)
(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))
(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")
(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
(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)
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")
(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))
(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)
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)
(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)
(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
(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)
"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.
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
(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))
; (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)))
(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))
(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
(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))
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)
(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
(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)
;;
(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
(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
(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))
(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))
;; 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))
(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)
(not (null (cdr dst-msgs)))
nil ; no-delete
nil ; same-number
- unread-marks
t))
(error nil))
(if result ; succeeded.
(not (null (cdr dst-msgs)))
t ; t is no-delete (copy)
nil ; same number
- unread-marks
t))
(error nil))
(if result ; succeeded.
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.
(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))
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
(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))))
(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
()
(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
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
(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)
(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)
(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)
: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")
: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)
: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)
: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)
: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.