(elmo-folder-msgdb-create-plugged): Ditto.
(elmo-folder-append-messages): Ditto.
(elmo-folder-list-answereds-plugged): Define.
(elmo-imap4-search-internal-primitive): Add `mark' processing.
(elmo-folder-unmark-answered-plugged): Define.
(elmo-folder-mark-as-answered-plugged): Ditto.
(elmo-folder-search-requires-msgdb-p): Ditto.
* elmo-filter.el (elmo-filter-folder): Added new slot 'require-msgdb'.
(elmo-folder-initialize): Set it.
(elmo-folder-msgdb): Define.
(elmo-folder-check): Call elmo-folder-synchronize.
(elmo-folder-close): Define.
(elmo-folder-commit): Ditto.
(elmo-folder-msgdb-create): Rewrite.
(elmo-folder-list-unreads): Ditto.
(elmo-folder-list-importants): Ditto.
(elmo-folder-mark-as-read): Ditto.
(elmo-folder-unmark-read): Ditto.
(elmo-folder-mark-as-important): Ditto.
(elmo-folder-unmark-important): Ditto.
(elmo-folder-mark-as-answered): Define.
(elmo-folder-unmark-answered): Ditto.
* elmo-dop.el (elmo-dop-queue-merge-method-list): Added
elmo-folder-mark-as-answered, elmo-folder-unmark-answered.
(elmo-dop-queue-method-name-alist): Likewise.
(elmo-folder-mark-as-answered-dop): New inline function.
(elmo-folder-unmark-answered-dop): Ditto.
(elmo-folder-status-dop): Treat spool-length as 0 if it does not exist.
* elmo-archive.el (elmo-folder-append-messages): Follow the API change.
(elmo-folder-msgdb-create): Ditto.
(elmo-archive-msgdb-create-as-numlist-subr1): Ditto.
(elmo-archive-msgdb-create-as-numlist-subr2): Ditto.
(elmo-archive-parse-mmdf): Ditto.
* elmo-cache.el (elmo-folder-msgdb-create): Ditto.
(elmo-folder-list-unreads-internal): Ditto.
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
spool-length
(i 0)
max-num)
- (setq spool-length (car (if (elmo-folder-exists-p spool-folder)
- (elmo-folder-status spool-folder))))
+ (setq spool-length (or (car (if (elmo-folder-exists-p spool-folder)
+ (elmo-folder-status spool-folder))) 0))
(setq max-num
(or (nth (max (- (length number-list) 1) 0) number-list)
0))
;;; 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-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" "mark"))
(total 0)
(length (length from-msgs))
charset set-list end results)
numbers)))
(mapcar '(lambda (x) (delete x numbers)) rest)
numbers))
+ ((string= "mark" search-key)
+ (cond
+ ((string= "unread" (elmo-filter-value filter))
+ (elmo-folder-list-unreads folder))
+ ((string= "important" (elmo-filter-value filter))
+ (elmo-folder-list-importants folder))
+ ((string= "answered" (elmo-filter-value filter))
+ (elmo-folder-list-answereds 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))