:group 'elmo)
(defcustom elmo-message-fetch-confirm t
- "Confirm fetching if message size is larger than `elmo-fetch-threshold'.
+ "If non-nil, confirm fetching if message size is larger than
+`elmo-message-fetch-threshold'.
Otherwise, entire fetching of the message is aborted without confirmation."
:type 'boolean
:group 'elmo)
persistent ; non-nil if persistent.
message-modified ; message is modified.
mark-modified ; mark is modified.
+ process-duplicates ; read or hide
))
(luna-define-internal-accessors 'elmo-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 ((list (elmo-folder-list-importants-internal folder important-mark)))
- (if (listp list)
- list
- ;; Not available, use current mark.
- (delq nil
- (mapcar
- (function
- (lambda (x)
- (if (string= (cadr x) important-mark)
- (car x))))
- (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder)))))))
+ (let ((importants (elmo-folder-list-importants-internal folder important-mark))
+ (number-alist (elmo-msgdb-get-number-alist
+ (elmo-folder-msgdb folder)))
+ num-pair result)
+ (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-dir)))))
+ (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)))
(luna-define-generic elmo-folder-list-messages-internal (folder &optional
visible-only)
If third optional argument UNREAD is non-nil, message is not marked as read.
Returns non-nil if fetching was succeed.")
+(luna-define-generic elmo-message-fetch-with-cache-process (folder
+ number strategy
+ &optional
+ section
+ unread)
+ "Fetch a message into current buffer with cache process.
+FOLDER is the ELMO folder structure.
+NUMBER is the number of the message in the FOLDER.
+STRATEGY is the message fetching strategy.
+If optional argument SECTION is specified, only the SECTION of the message
+is fetched (if possible).
+If second optional argument UNREAD is non-nil, message is not marked as read.
+Returns non-nil if fetching was succeed.")
+
+(luna-define-generic elmo-message-fetch-internal (folder number strategy
+ &optional
+ section
+ unread)
+ "Fetch a message into current buffer.
+FOLDER is the ELMO folder structure.
+NUMBER is the number of the message in the FOLDER.
+STRATEGY is the message fetching strategy.
+If optional argument SECTION is specified, only the SECTION of the message
+is fetched (if possible).
+If second optional argument UNREAD is non-nil, message is not marked as read.
+Returns non-nil if fetching was succeed.")
+
(luna-define-generic elmo-message-folder (folder number)
"Get primitive folder of the message.")
(elmo-folder-msgdb folder))
number-alist)))
(cur number-alist)
- pair
+ pair overview
to-be-deleted
mark-alist)
(while cur
(if (setq pair (rassoc (cdr (car cur)) all-alist))
(setq to-be-deleted (nconc to-be-deleted (list (car pair)))))
(setq cur (cdr cur)))
- ;; XXXX If caching is enabled, read-uncached mark should be set.
- (setq mark-alist (elmo-delete-if
- (function
- (lambda (x)
- (memq (car x) to-be-deleted)))
- (elmo-msgdb-get-mark-alist append-msgdb)))
- (elmo-msgdb-set-mark-alist append-msgdb mark-alist)
+ (cond ((eq (elmo-folder-process-duplicates-internal folder)
+ 'hide)
+ ;; Hide duplicates.
+ (setq overview (elmo-delete-if
+ (lambda (x)
+ (memq (elmo-msgdb-overview-entity-get-number
+ x)
+ to-be-deleted))
+ (elmo-msgdb-get-overview append-msgdb)))
+ ;; Should be mark as read.
+ (elmo-folder-mark-as-read folder to-be-deleted)
+ (elmo-msgdb-set-overview append-msgdb overview))
+ ((eq (elmo-folder-process-duplicates-internal folder)
+ 'read)
+ ;; Mark as read duplicates.
+ (elmo-folder-mark-as-read folder to-be-deleted))
+ (t
+ ;; Do nothing.
+ (setq to-be-deleted nil)))
(elmo-folder-set-msgdb-internal folder
(elmo-msgdb-append
(elmo-folder-msgdb folder)
(nthcdr (max (- len elmo-folder-update-threshold) 0) appends)
appends))))
+(luna-define-method elmo-message-fetch ((folder elmo-folder)
+ number strategy
+ &optional
+ section
+ outbuf
+ unread)
+ (if outbuf
+ (with-current-buffer outbuf
+ (erase-buffer)
+ (elmo-message-fetch-with-cache-process folder number
+ strategy section unread)
+ t)
+ (with-temp-buffer
+ (elmo-message-fetch-with-cache-process folder number
+ strategy section unread)
+ (buffer-string))))
+
+(luna-define-method elmo-message-fetch-with-cache-process ((folder elmo-folder)
+ number strategy
+ &optional
+ section unread)
+ (let (cache-file)
+ (if (and (elmo-fetch-strategy-use-cache strategy)
+ (setq cache-file (elmo-file-cache-expand-path
+ (elmo-fetch-strategy-cache-path strategy)
+ section))
+ (file-exists-p cache-file))
+ (insert-file-contents-as-binary cache-file)
+ (elmo-message-fetch-internal folder number strategy section unread)
+ (elmo-delete-cr-buffer)
+ (when (and (> (buffer-size) 0)
+ (elmo-fetch-strategy-save-cache strategy)
+ (elmo-fetch-strategy-cache-path strategy))
+ (elmo-file-cache-save
+ (elmo-fetch-strategy-cache-path strategy)
+ section)))))
+
(defun elmo-folder-synchronize (folder
new-mark ;"N"
unread-uncached-mark ;"U"
(elmo-msgdb-append-to-killed-list folder (car diff-2)))
;; Don't delete important marked messages.
(setq delete-list
- (elmo-delete-if
- (lambda (x)
- (and (setq mark (cadr (assq x mark-alist)))
- (string= mark important-mark)))
- ;; delete message list
- (cadr diff)))
+ (if (eq (elmo-folder-type-internal folder) 'mark)
+ (cadr diff)
+ (elmo-delete-if
+ (lambda (x)
+ (and (setq mark (cadr (assq x mark-alist)))
+ (string= mark important-mark)))
+ ;; delete message list
+ (cadr diff))))
(if (or (equal diff '(nil nil))
(equal diff '(nil))
(and (eq (length (car diff)) 0)