+2003-03-25 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo.el (elmo-folder-append-buffer): Changed argument from unread
+ to flag. (All other related portions are changed.)
+ (elmo-folder-msgdb-create): Likewise.
+ (elmo-generic-folder-append-messages): Use flag-table instead of
+ seen-list.
+ (elmo-folder-move-messages): Removed redundant process.
+ (elmo-folder-synchronize): Likewise.
+
+ * elmo-msgdb.el (elmo-flag-table-get): New function.
+ (elmo-flag-table-save): Fixed.
+ (elmo-msgdb-length): New inline function.
+ (elmo-msgdb-flag-table): New function.
+ (elmo-msgdb-mark): Add optional argument new.
+ (elmo-msgdb-add-msgs-to-seen-list): Abolish.
+ (elmo-msgdb-seen-list): Ditto.
+ (elmo-msgdb-add-msgs-to-seen-list): Ditto.
+
+
2003-03-24 Yuuichi Teranishi <teranisi@gohome.org>
* elmo.el (elmo-message-set-mark): Abolish.
(elmo-archive-message-fetch-internal folder number))
(luna-define-method elmo-folder-append-buffer ((folder elmo-archive-folder)
- unread &optional number)
- (elmo-archive-folder-append-buffer folder unread number))
+ &optional flag number)
+ (elmo-archive-folder-append-buffer folder flag number))
;; verrrrrry slow!!
-(defun elmo-archive-folder-append-buffer (folder unread number)
+(defun elmo-archive-folder-append-buffer (folder flag number)
(let* ((type (elmo-archive-folder-archive-type-internal folder))
(prefix (elmo-archive-folder-archive-prefix-internal folder))
(arc (elmo-archive-get-archive-name folder))
(elmo-archive-msgdb-create-entity-subr number))))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-archive-folder)
- numbers seen-list)
+ numbers flag-table)
(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 seen-list)
+ folder numbers flag-table)
(elmo-archive-msgdb-create-as-numlist-subr1
- folder numbers seen-list)))))
+ folder numbers flag-table)))))
-(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist seen-list)
+(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist flag-table)
(let* ((type (elmo-archive-folder-archive-type-internal folder))
(file (elmo-archive-get-archive-name folder))
(method (elmo-archive-get-method type 'cat))
(elmo-msgdb-overview-entity-get-number entity)
(car entity)))
(setq message-id (car entity))
- (setq seen (member message-id seen-list))
(if (setq gmark
(or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-file-cache-status
- (elmo-file-cache-get message-id))
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- elmo-msgdb-read-uncached-mark
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
;;; info-zip agent
(defun elmo-archive-msgdb-create-as-numlist-subr2 (folder
numlist
- seen-list)
+ flag-table)
(let* ((delim1 elmo-mmdf-delimiter) ;; MMDF
(delim2 elmo-unixmail-delimiter) ;; UNIX Mail
(type (elmo-archive-folder-archive-type-internal folder))
(goto-char (point-min))
(cond
((looking-at delim1) ;; MMDF
- (setq result (elmo-archive-parse-mmdf msgs seen-list))
+ (setq result (elmo-archive-parse-mmdf msgs flag-table))
(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 seen-list)
+(defun elmo-archive-parse-mmdf (msgs flag-table)
(let ((delim elmo-mmdf-delimiter)
number sp ep rest entity overview number-alist mark-alist ret-val
- message-id seen gmark)
+ message-id gmark)
(goto-char (point-min))
(setq rest msgs)
(while (and rest (re-search-forward delim nil t)
(elmo-msgdb-overview-entity-get-number entity)
(car entity)))
(setq message-id (car entity))
- (setq seen (member message-id seen-list))
(if (setq gmark
(or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-file-cache-status
- (elmo-file-cache-get message-id))
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- elmo-msgdb-read-uncached-mark
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
(elmo-cache-folder-directory-internal folder)))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-cache-folder)
- numbers seen-list)
+ numbers flag-table)
(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
- elmo-msgdb-new-mark)))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
(list overview number-alist mark-alist)))
(luna-define-method elmo-folder-append-buffer ((folder elmo-cache-folder)
- unread
- &optional number)
+ &optional flag number)
;; dir-name is changed according to msgid.
(unless (elmo-cache-folder-dir-name-internal folder)
(let* ((file (elmo-file-cache-get-path (std11-field-body "message-id")))
(car (elmo-dop-queue-arguments queue)))))))))
;;; DOP operations.
-(defsubst elmo-folder-append-buffer-dop (folder unread &optional number)
+(defsubst elmo-folder-append-buffer-dop (folder &optional flag number)
(elmo-dop-queue-append
folder 'elmo-folder-append-buffer-dop-delayed
- (list unread
+ (list flag
(elmo-dop-spool-folder-append-buffer
folder)
number)))
(cons (+ max-num spool-length) (+ (length number-list) spool-length))))
;;; Delayed operation (executed at online status).
-(defun elmo-folder-append-buffer-dop-delayed (folder unread number set-number)
+(defun elmo-folder-append-buffer-dop-delayed (folder flag number set-number)
(let ((spool-folder (elmo-dop-spool-folder folder))
failure saved dequeued)
(with-temp-buffer
(condition-case nil
(setq failure (not
(elmo-folder-append-buffer
- folder unread set-number)))
+ folder
+ (if (eq flag t) nil flag) ; for compatibility
+ set-number)))
(error (setq failure t)))
(setq dequeued t)) ; Already deletef from queue.
(when failure
;; Append failed...
(setq saved (elmo-folder-append-buffer
(elmo-make-folder elmo-lost+found-folder)
- unread set-number)))
+ (if (eq flag t) nil flag) ; for compatibility
+ set-number)))
(if (and (not dequeued) ; if dequeued, no need to delete.
(or (not failure) ; succeed
saved)) ; in lost+found
type))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-filter-folder)
- numlist seen-list)
+ numlist flag-table)
(if (elmo-filter-folder-require-msgdb-internal folder)
(let* ((target-folder (elmo-filter-folder-target-internal folder))
(len (length numlist))
;; Does not require msgdb.
(elmo-folder-msgdb-create
(elmo-filter-folder-target-internal folder)
- numlist seen-list)))
+ numlist flag-table)))
(luna-define-method elmo-folder-append-buffer ((folder elmo-filter-folder)
- unread &optional number)
+ &optional flag number)
(elmo-folder-append-buffer
(elmo-filter-folder-target-internal folder)
- unread number))
+ flag number))
(luna-define-method elmo-message-fetch ((folder elmo-filter-folder)
number strategy
;;
;; app-data:
-;; cons of seen-list and result of use-flag-p.
+;; cons of flag-table 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) app-data))
mark)
(if (member "\\Flagged" flags)
(elmo-msgdb-global-mark-set (car entity)
;; cached.
(if (member "\\Answered" flags)
elmo-msgdb-answered-cached-mark
- (if (or seen
- (and use-flag
- (member "\\Seen" flags)))
+ (if (and use-flag
+ (member "\\Seen" flags))
nil
elmo-msgdb-unread-cached-mark))
(if (member "\\Answered" flags)
elmo-msgdb-answered-uncached-mark
- (if (or seen
- (and use-flag
- (member "\\Seen" flags)))
+ (if (and use-flag
+ (member "\\Seen" flags))
(if elmo-imap4-use-cache
elmo-msgdb-read-uncached-mark)
elmo-msgdb-new-mark))))))
(luna-call-next-method)))
(luna-define-method elmo-folder-msgdb-create-plugged
- ((folder elmo-imap4-folder) numbers seen-list)
+ ((folder elmo-imap4-folder) numbers flag-table)
(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 seen-list
+ elmo-imap4-fetch-callback-data (cons flag-table
(elmo-folder-use-flag-p
folder)))
(while set-list
(elmo-imap4-folder-mailbox-internal folder)))))
(luna-define-method elmo-folder-append-buffer
- ((folder elmo-imap4-folder) unread &optional number)
+ ((folder elmo-imap4-folder) &optional flag number)
(if (elmo-folder-plugged-p folder)
(let ((session (elmo-imap4-get-session folder))
send-buffer result)
"append "
(elmo-imap4-mailbox (elmo-imap4-folder-mailbox-internal
folder))
- (if unread " () " " (\\Seen) ")
+ (cond
+ ((eq flag 'read) " (\\Seen) ")
+ ((eq flag 'answered) " (\\Answered)")
+ (t " () "))
(elmo-imap4-buffer-literal send-buffer))))
(kill-buffer send-buffer))
result)
;; Unplugged
(if elmo-enable-disconnected-operation
- (elmo-folder-append-buffer-dop folder unread number)
+ (elmo-folder-append-buffer-dop folder flag number)
(error "Unplugged"))))
(eval-when-compile
(luna-define-method elmo-folder-msgdb-create ((folder elmo-localdir-folder)
numbers
- seen-list)
+ flag-table)
(when numbers
(let ((dir (elmo-localdir-folder-directory-internal folder))
overview number-alist mark-alist entity message-id
- num seen gmark
+ num gmark
(i 0)
(len (length numbers)))
(message "Creating msgdb...")
(elmo-msgdb-number-add number-alist
num
message-id))
- (setq 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) ; XXX
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- nil ;;seen-mark
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
(elmo-maildir-folder-flagged-locations-internal folder))
(luna-define-method elmo-folder-msgdb-create
- ((folder elmo-maildir-folder) numbers seen-list)
+ ((folder elmo-maildir-folder) numbers flag-table)
(let* ((unread-list (elmo-maildir-folder-unread-locations-internal folder))
(flagged-list (elmo-maildir-folder-flagged-locations-internal folder))
(len (length numbers))
filename))
(luna-define-method elmo-folder-append-buffer ((folder elmo-maildir-folder)
- unread &optional number)
+ &optional status number)
(let ((basedir (elmo-maildir-folder-directory-internal folder))
(src-buf (current-buffer))
dst-buf filename)
(elmo-map-message-location folder number)))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-mark-folder)
- numbers seen-list)
+ numbers flag-table)
(elmo-mark-folder-msgdb-create folder numbers))
(defun elmo-mark-folder-msgdb-create (folder numbers)
(list overview number-alist mark-alist)))
(luna-define-method elmo-folder-append-buffer ((folder elmo-mark-folder)
- unread &optional number)
+ &optional flag number)
(let* ((msgid (elmo-field-body "message-id"))
(path (elmo-file-cache-get-path msgid))
dir)
;; elmo-msgdb-delete-msgs MSGDB NUMBERS
;; elmo-msgdb-sort-by-date MSGDB
-;; elmo-msgdb-id-mark-table-load
-;; elmo-msgdb-id-mark-table-save
+;; elmo-flag-table-load
+;; elmo-flag-table-set
+;; elmo-flag-table-get
+;; elmo-flag-table-save
;; elmo-msgdb-append-entity-from-buffer
-;; msgdb number flag id-mark-table &optional buffer
+;; msgdb number flag-table &optional buffer
+
+;;
;; ENTITY elmo-msgdb-make-entity ARGS
;; VALUE elmo-msgdb-entity-field ENTITY
;; elmo-crosspost-alist-load
;; elmo-crosspost-alist-save
-;; elmo-msgdb-add-msgs-to-seen-list MSGS MSGDB SEEN-LIST
-
;; elmo-msgdb-create-overview-from-buffer NUMBER SIZE TIME
;; elmo-msgdb-copy-overview-entity ENTITY
;; elmo-msgdb-create-overview-entity-from-file NUMBER FILE
(defun elmo-flag-table-set (flag-table msg-id flag)
(elmo-set-hash-val msg-id flag flag-table))
+(defun elmo-flag-table-get (flag-table msg-id)
+ (elmo-get-hash-val msg-id flag-table))
+
(defun elmo-flag-table-save (dir flag-table)
(elmo-object-save
(expand-file-name elmo-flag-table-filename dir)
- (let (list)
- (mapatoms (lambda (atom)
- (setq list (cons (cons (symbol-name atom)
- (symbol-value atom))
- list)))
- flag-table)
- list)))
+ (if flag-table
+ (let (list)
+ (mapatoms (lambda (atom)
+ (setq list (cons (cons (symbol-name atom)
+ (symbol-value atom))
+ list)))
+ flag-table)
+ list))))
;;;
;; persistent mark handling
;; (for each folder)
(setq alist (elmo-msgdb-append-element alist
(list id mark))))
-(defun elmo-msgdb-seen-list (msgdb)
- "Get SEEN-MSGID-LIST from MSGDB."
- (let ((ov (elmo-msgdb-get-overview msgdb))
- mark seen-list)
- (while ov
- (if (setq mark (elmo-msgdb-get-mark
- msgdb
- (elmo-msgdb-overview-entity-get-number (car ov))))
- (if (and mark (not (member mark
- (elmo-msgdb-unread-marks))))
- (setq seen-list (cons
- (elmo-msgdb-overview-entity-get-id (car ov))
- seen-list)))
- (setq seen-list (cons
- (elmo-msgdb-overview-entity-get-id (car ov))
- seen-list)))
- (setq ov (cdr ov)))
- seen-list))
+(defsubst elmo-msgdb-length (msgdb)
+ (length (elmo-msgdb-get-overview msgdb)))
+
+(defun elmo-msgdb-flag-table (msgdb &optional flag-table)
+ ;; Make a table of msgid flag (read, answered)
+ (let ((flag-table (or flag-table (elmo-make-hash (elmo-msgdb-length msgdb))))
+ mark)
+ (dolist (ov (elmo-msgdb-get-overview msgdb))
+ (setq mark (elmo-msgdb-get-mark
+ msgdb
+ (elmo-msgdb-overview-entity-get-number ov)))
+ (cond
+ ((null mark)
+ (elmo-set-hash-val
+ (elmo-msgdb-overview-entity-get-id ov)
+ 'read
+ flag-table))
+ ((and mark (member mark (elmo-msgdb-answered-marks)))
+ (elmo-set-hash-val
+ (elmo-msgdb-overview-entity-get-id ov)
+ 'answered
+ flag-table))
+ ((and mark (not (member mark
+ (elmo-msgdb-unread-marks))))
+ (elmo-set-hash-val
+ (elmo-msgdb-overview-entity-get-id ov)
+ 'read
+ flag-table))))
+ flag-table))
;;
;; mime decode cache
(setcar (cdr entity) after))
(setq mark-alist (cdr mark-alist)))))
-(defsubst elmo-msgdb-mark (flag cached)
- (case flag
- (unread
- (if cached
- elmo-msgdb-unread-cached-mark
- elmo-msgdb-unread-uncached-mark))
- (important
- elmo-msgdb-important-mark)
- (answered
- (if cached
- elmo-msgdb-answered-cached-mark
- elmo-msgdb-answered-uncached-mark))))
+(defsubst elmo-msgdb-mark (flag cached &optional new)
+ (if new
+ (case flag
+ (read
+ (if cached
+ nil
+ elmo-msgdb-read-uncached-mark))
+ (important
+ elmo-msgdb-important-mark)
+ (answered
+ (if cached
+ elmo-msgdb-answered-cached-mark
+ elmo-msgdb-answered-uncached-mark))
+ (t
+ (if cached
+ elmo-msgdb-unread-cached-mark
+ elmo-msgdb-new-mark)))
+ (case flag
+ (unread
+ (if cached
+ elmo-msgdb-unread-cached-mark
+ elmo-msgdb-unread-uncached-mark))
+ (important
+ elmo-msgdb-important-mark)
+ (answered
+ (if cached
+ elmo-msgdb-answered-cached-mark
+ elmo-msgdb-answered-uncached-mark)))))
(defsubst elmo-msgdb-seen-save (dir obj)
(elmo-object-save
elmo-msgdb-directory)
alist))
-(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 (elmo-msgdb-unread-marks)) ;; not unread mark
- (setq seen-list
- (cons
- (elmo-msgdb-get-field msgdb (car msgs) 'message-id)
- seen-list)))
- ;; no mark ... seen...
- (setq seen-list
- (cons
- (elmo-msgdb-get-field msgdb (car msgs) 'message-id)
- seen-list)))
- (setq msgs (cdr msgs)))
- seen-list))
-
(defun elmo-msgdb-get-message-id-from-buffer ()
(let ((msgid (elmo-field-body "message-id")))
(if msgid
numbers-list))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-multi-folder)
- numbers seen-list)
+ numbers flag-table)
(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)
- seen-list)
+ flag-table)
(* (elmo-multi-folder-divide-number-internal folder)
(1+ cur-number))))))
(setq cur-number (1+ cur-number)))
(elmo-folder-delete-messages-dop folder numbers))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-net-folder)
- numbers seen-list)
+ numbers flag-table)
(if (elmo-folder-plugged-p folder)
(elmo-folder-send folder 'elmo-folder-msgdb-create-plugged
- numbers seen-list)
+ numbers flag-table)
(elmo-folder-send folder 'elmo-folder-msgdb-create-unplugged
- numbers seen-list)))
+ numbers flag-table)))
(luna-define-method elmo-folder-msgdb-create-unplugged ((folder
elmo-net-folder)
numbers
- seen-list)
+ flag-table)
;; XXXX should be appended to already existing msgdb.
(elmo-dop-msgdb
(elmo-folder-msgdb-create (elmo-dop-spool-folder folder)
(mapcar 'abs numbers)
- seen-list)))
+ flag-table)))
(luna-define-method elmo-folder-unmark-important :before ((folder
elmo-net-folder)
entity))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder)
- numlist seen-list)
+ numlist flag-table)
(let* (overview number-alist mark-alist entity
i percent num pair)
(setq num (length numlist))
("xref" . 8)))
(defun elmo-nntp-create-msgdb-from-overview-string (str
- seen-list
+ flag-table
&optional numlist)
(let (ov-list gmark message-id seen
ov-entity overview number-alist mark-alist num
(elmo-msgdb-number-add number-alist num
(aref ov-entity 4)))
(setq message-id (aref ov-entity 4))
- (setq seen (member message-id seen-list))
(if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-file-cache-status
- (elmo-file-cache-get message-id))
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- (if elmo-nntp-use-cache
- elmo-msgdb-read-uncached-mark)
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(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 seen-list)
- (elmo-nntp-folder-msgdb-create folder numbers seen-list))
+ numbers flag-table)
+ (elmo-nntp-folder-msgdb-create folder numbers flag-table))
-(defun elmo-nntp-folder-msgdb-create (folder numbers seen-list)
+(defun elmo-nntp-folder-msgdb-create (folder numbers flag-table)
(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
- seen-list
+ flag-table
filter
)))))
(if (null (elmo-nntp-read-response session t))
'elmo-nntp-msgdb-create "Getting overview..." 100)))
(if (not use-xover)
(setq ret-val (elmo-nntp-msgdb-create-by-header
- session numbers seen-list))
+ session numbers flag-table))
(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
- seen-list
+ flag-table
filter))))))
(elmo-folder-set-killed-list-internal
folder
(nconc number-alist
(list (cons max-number nil))))))))))
-(defun elmo-nntp-msgdb-create-by-header (session numbers seen-list)
+(defun elmo-nntp-msgdb-create-by-header (session numbers flag-table)
(with-temp-buffer
(elmo-nntp-retrieve-headers session (current-buffer) numbers)
(elmo-nntp-msgdb-create-message
- (length numbers) seen-list)))
+ (length numbers) flag-table)))
(defun elmo-nntp-parse-xhdr-response (string)
(let (response)
;; end of from Gnus
-(defun elmo-nntp-msgdb-create-message (len seen-list)
+(defun elmo-nntp-msgdb-create-message (len flag-table)
(save-excursion
(let (beg overview number-alist mark-alist
entity i num gmark seen message-id)
(elmo-msgdb-overview-entity-get-number entity)
(car entity)))
(setq message-id (car entity))
- (setq seen (member message-id seen-list))
(if (setq gmark
(or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-file-cache-status
- (elmo-file-cache-get message-id))
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- (if elmo-nntp-use-cache
- elmo-msgdb-read-uncached-mark)
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
(elmo-folder-contains-type (elmo-pipe-folder-dst-internal folder) type)))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-pipe-folder)
- numlist seen-list)
+ numlist flag-table)
(elmo-folder-msgdb-create (elmo-pipe-folder-dst-internal folder)
- numlist seen-list))
+ numlist flag-table))
(luna-define-method elmo-folder-append-messages ((folder elmo-pipe-folder)
src-folder numbers
same-number))
(luna-define-method elmo-folder-append-buffer ((folder elmo-pipe-folder)
- unread &optional number)
+ &optional flag number)
(elmo-folder-append-buffer (elmo-pipe-folder-dst-internal folder)
- unread number))
+ flag number))
(luna-define-method elmo-message-fetch ((folder elmo-pipe-folder)
number strategy
(copy-to-buffer tobuffer (point-min) (point-max)))))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-pop3-folder)
- numlist seen-list)
+ numlist flag-table)
(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
- seen-list
+ flag-table
(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
- seen-list
+ flag-table
loc-alist)
(let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")))
(with-current-buffer (process-buffer process)
process
(length numlist)
numlist
- seen-list loc-alist)
+ flag-table loc-alist)
(kill-buffer tmp-buffer)))))
(defun elmo-pop3-msgdb-create-message (buffer
process
num
numlist
- seen-list
+ flag-table
loc-alist)
(save-excursion
(let (beg overview number-alist mark-alist
(elmo-msgdb-overview-entity-get-number entity)
(car entity)))
(setq message-id (car entity))
- (setq seen (member message-id seen-list))
(if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (if (elmo-file-cache-status
- (elmo-file-cache-get message-id))
- (if seen
- nil
- elmo-msgdb-unread-cached-mark)
- (if seen
- (if elmo-pop3-use-cache
- elmo-msgdb-read-uncached-mark)
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(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 seen-list)
+ numbers flag-table)
(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
- elmo-msgdb-new-mark)))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append
mark-alist
(list (cons "xref" (shimbun-header-xref header)))))))))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder)
- numlist seen-list)
+ numlist flag-table)
(let* (overview number-alist mark-alist entity
i percent number length pair msgid gmark seen)
(setq length (length numlist))
(setq number-alist
(elmo-msgdb-number-add number-alist
number msgid))
- (setq seen (member msgid seen-list))
(if (setq gmark (or (elmo-msgdb-global-mark-get msgid)
- (if (elmo-file-cache-status
- (elmo-file-cache-get msgid))
- (if seen nil elmo-msgdb-unread-cached-mark)
- (if seen
- (if elmo-shimbun-use-cache
- elmo-msgdb-read-uncached-mark)
- elmo-msgdb-new-mark))))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table msgid)
+ (elmo-file-cache-status
+ (elmo-file-cache-get msgid))
+ 'new)))
(setq mark-alist
(elmo-msgdb-mark-append mark-alist
number gmark))))
action)))
(elmo-folder-create target-folder)))
(elmo-folder-open-internal target-folder)
- (elmo-folder-append-buffer target-folder 'unread)
+ (elmo-folder-append-buffer target-folder)
(elmo-folder-close-internal target-folder))
(error (setq failure t)
(incf fcount)))
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 id-mark-table)
+(luna-define-generic elmo-folder-msgdb-create (folder numbers flag-table)
"Create a message database (implemented in each backends).
FOLDER is the ELMO folder structure.
NUMBERS is a list of message numbers to create msgdb.
-ID-MARK-TABLE is a hashtable of message-id and its status mark.")
+FLAG-TABLE is a hashtable of message-id and flag.")
(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-append-buffer (folder unread &optional number)
+(luna-define-generic elmo-folder-append-buffer (folder &optional flag
+ number)
"Append current buffer as a new message.
FOLDER is the destination folder(ELMO folder structure).
-If UNREAD is non-nil, message is appended as unread.
+FLAG is the status of appended message.
If optional argument NUMBER is specified, the new message number is set
\(if possible\).")
(defun elmo-generic-folder-append-messages (folder src-folder numbers
same-number)
- (let (unseen seen-list succeed-numbers failure cache)
+ (let (unseen table flag mark
+ succeed-numbers failure cache)
+ (setq table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
(with-temp-buffer
(set-buffer-multibyte nil)
(while numbers
- (setq failure nil)
+ (setq failure nil
+ mark (elmo-message-mark src-folder (car numbers))
+ flag (cond
+ ((member mark (elmo-msgdb-answered-marks))
+ 'answered)
+ ;;
+ ((not (member mark (elmo-msgdb-unread-marks)))
+ 'read)))
(condition-case nil
(setq cache (elmo-file-cache-get
(elmo-message-field src-folder
(> (buffer-size) 0)
(elmo-folder-append-buffer
folder
- (setq unseen (member (elmo-message-mark
- src-folder (car numbers))
- (elmo-msgdb-unread-marks)))
+ flag
(if same-number (car numbers))))))
(error (setq failure t)))
;; FETCH & APPEND finished
(unless failure
- (unless unseen
- (setq seen-list (cons (elmo-message-field
- src-folder (car numbers)
- 'message-id)
- seen-list)))
+ (when flag
+ (elmo-flag-table-set table
+ (elmo-message-field
+ src-folder (car numbers)
+ 'message-id)
+ flag))
(setq succeed-numbers (cons (car numbers) succeed-numbers)))
(elmo-progress-notify 'elmo-folder-move-messages)
(setq numbers (cdr numbers)))
- (if (and seen-list (elmo-folder-persistent-p folder))
- (elmo-msgdb-seen-save (elmo-folder-msgdb-path folder)
- (nconc (elmo-msgdb-seen-load
- (elmo-folder-msgdb-path folder))
- seen-list)))
+ (when (elmo-folder-persistent-p folder)
+ (elmo-flag-table-save (elmo-folder-msgdb-path folder) table))
succeed-numbers)))
;; Arguments should be reduced.
same-number))
(error "move: append message to %s failed"
(elmo-folder-name-internal dst-folder)))
- (elmo-folder-close dst-folder))
- (when (and (elmo-folder-persistent-p dst-folder)
- save-unread)
- ;; Save to seen list.
- (let* ((dir (elmo-folder-msgdb-path dst-folder))
- (seen-list (elmo-msgdb-seen-load dir)))
- (setq seen-list
- (elmo-msgdb-add-msgs-to-seen-list
- msgs (elmo-folder-msgdb src-folder)
- seen-list))
- (elmo-msgdb-seen-save dir seen-list))))
+ (elmo-folder-close dst-folder)))
(if (and (not no-delete) succeeds)
(progn
(if (not no-delete-info)
(before-append t)
number-alist mark-alist
old-msgdb diff diff-2 delete-list new-list new-msgdb mark
- seen-list crossed after-append)
+ flag-table crossed after-append)
(setq old-msgdb (elmo-folder-msgdb folder))
- ;; Load seen-list.
- (setq seen-list (elmo-msgdb-seen-load (elmo-folder-msgdb-path folder)))
+ (setq flag-table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
(setq number-alist (elmo-msgdb-get-number-alist
(elmo-folder-msgdb folder)))
(setq mark-alist (elmo-msgdb-get-mark-alist
(elmo-folder-msgdb folder)))
- (if ignore-msgdb
- (progn
- (setq seen-list (nconc (elmo-msgdb-seen-list
- (elmo-folder-msgdb folder))
- seen-list))
- (elmo-folder-clear folder (eq ignore-msgdb 'visible-only))))
+ (when ignore-msgdb
+ (elmo-msgdb-flag-table (elmo-folder-msgdb folder) flag-table)
+ (elmo-folder-clear folder (eq ignore-msgdb 'visible-only)))
(unless no-check (elmo-folder-check folder))
(condition-case nil
(progn
(elmo-folder-msgdb folder) delete-list))
(when new-list
(setq new-msgdb (elmo-folder-msgdb-create
- folder new-list seen-list))
+ folder new-list flag-table))
(elmo-msgdb-change-mark (elmo-folder-msgdb folder)
elmo-msgdb-new-mark
elmo-msgdb-unread-uncached-mark)
- ;; Clear seen-list.
+ ;; Clear flag-table
(if (elmo-folder-persistent-p folder)
- (setq seen-list (elmo-msgdb-seen-save
- (elmo-folder-msgdb-path folder) nil)))
+ (elmo-flag-table-save (elmo-folder-msgdb-path folder)
+ nil))
(setq before-append nil)
(setq crossed (elmo-folder-append-msgdb folder new-msgdb))
;; process crosspost.
(or crossed 0)))
(quit
;; Resume to the original status.
- (if before-append
- (elmo-folder-set-msgdb-internal folder old-msgdb))
+ (if before-append (elmo-folder-set-msgdb-internal folder old-msgdb))
(elmo-folder-set-killed-list-internal folder killed-list)
nil))))