* elmo-version.el (elmo-version): Up to 2.11.10.
+2003-08-30 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-msgdb.el (elmo-msgdb-mark-to-flags): New function.
+ (elmo-msgdb-flags-to-mark): Ditto.
+ (elmo-msgdb-append-entity): Ditto.
+
+ * elmo-archive.el (elmo-archive-msgdb-create-as-numlist-subr1):
+ Use `elmo-msgdb-append-entity' instead of construct msgdb.
+ (elmo-archive-msgdb-create-as-numlist-subr2): Ditto.
+ (elmo-archive-parse-mmdf): Ditto.
+
+ * elmo-cache.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-filter.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-localdir.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-maildir.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-mark.el (elmo-mark-folder-msgdb-create): Ditto.
+
+ * elmo-nmz.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-sendlog.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-shimbun.el (elmo-folder-msgdb-create): Ditto.
+
+ * elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Ditto.
+ (elmo-folder-msgdb-create-plugged): Set elmo-imap4-current-msgdb
+ to empty msgdb.
+
+ * elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Use
+ `elmo-msgdb-make-message-entity' and `elmo-msgdb-append-entity'
+ instead of directly construction.
+ (elmo-nntp-msgdb-create-message): Use `elmo-msgdb-append-entity'
+ instead of construct msgdb.
+
+ * elmo-pop3.el (elmo-pop3-sort-msgdb-by-original-number): Use
+ `elmo-msgdb-set-overview' instead of reconstruct msgdb.
+ (elmo-pop3-msgdb-create-message): Use `elmo-msgdb-append-entity'
+ instead of construct msgdb.
+
2003-08-28 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo-msgdb.el (elmo-msgdb-message-entity-field): Decode value
(let* ((type (elmo-archive-folder-archive-type-internal folder))
(file (elmo-archive-get-archive-name folder))
(method (elmo-archive-get-method type 'cat))
- overview number-alist mark-alist entity
- i percent num message-id seen gmark)
+ (new-msgdb (elmo-make-msgdb))
+ entity i percent num message-id gmark)
(with-temp-buffer
(setq num (length numlist))
(setq i 0)
method file (car numlist) type
(elmo-archive-folder-archive-prefix-internal folder)))
(when entity
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq number-alist
- (elmo-msgdb-number-add
- number-alist
- (elmo-msgdb-overview-entity-get-number entity)
- (car entity)))
- (setq message-id (car entity))
- (if (setq gmark
- (or (elmo-msgdb-global-mark-get message-id)
- (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-msgdb-overview-entity-get-number entity)
- gmark))))
+ (setq message-id (elmo-msgdb-overview-entity-get-id entity))
+ (setq gmark
+ (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark))
(when (> num elmo-display-progress-threshold)
(setq i (1+ i))
(setq percent (/ (* i 100) num))
percent))
(setq numlist (cdr numlist)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist))))
+ new-msgdb)))
;;; info-zip agent
(defun elmo-archive-msgdb-create-as-numlist-subr2 (folder
(prog (car method))
(args (cdr method))
(arc (elmo-archive-get-archive-name folder))
- n i percent num result overview number-alist mark-alist
- msgs case-fold-search)
+ (new-msgdb (elmo-make-msgdb))
+ n i percent num msgs case-fold-search)
(with-temp-buffer
(setq num (length numlist))
(setq i 0)
(goto-char (point-min))
(cond
((looking-at delim1) ;; MMDF
- (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))))
-;;; ((looking-at delim2) ;; UNIX MAIL
-;;; (setq result (elmo-archive-parse-unixmail msgs))
-;;; (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))))
+ (elmo-msgdb-append
+ new-msgdb
+ (elmo-archive-parse-mmdf msgs flag-table)))
+;;; ((looking-at delim2) ;; UNIX MAIL
+;;; (elmo-msgdb-append
+;;; new-msgdb
+;;; (elmo-archive-parse-unixmail msgs flag-table)))
(t ;; unknown format
(error "Unknown format!")))
(when (> num elmo-display-progress-threshold)
(elmo-display-progress
'elmo-archive-msgdb-create-as-numlist-subr2 "Creating msgdb..."
percent))))
- (list overview number-alist mark-alist)))
+ new-msgdb))
(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
+ (new-msgdb (elmo-make-msgdb))
+ number sp ep rest entity
message-id gmark)
(goto-char (point-min))
(setq rest msgs)
(save-excursion
(narrow-to-region sp ep)
(setq entity (elmo-archive-msgdb-create-entity-subr number))
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq number-alist
- (elmo-msgdb-number-add
- number-alist
- (elmo-msgdb-overview-entity-get-number entity)
- (car entity)))
- (setq message-id (car entity))
- (if (setq gmark
- (or (elmo-msgdb-global-mark-get message-id)
- (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-msgdb-overview-entity-get-number entity)
- gmark)))
- (setq ret-val (append ret-val (list overview number-alist
- mark-alist)))
+ (setq message-id (elmo-msgdb-overview-entity-get-id entity))
+ (setq gmark
+ (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark)
(widen)))
(forward-line 1)
(setq rest (cdr rest)))
- ret-val))
+ new-msgdb))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
numbers flag-table)
(let ((i 0)
(len (length numbers))
- overview number-alist mark-alist entity message-id
- num mark)
+ (new-msgdb (elmo-make-msgdb))
+ entity message-id mark)
(message "Creating msgdb...")
(while numbers
(setq entity
(elmo-msgdb-create-overview-entity-from-file
(car numbers) (elmo-message-file-name folder (car numbers))))
- (if (null entity)
- ()
- (setq num (elmo-msgdb-overview-entity-get-number entity))
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
+ (when entity
(setq message-id (elmo-msgdb-overview-entity-get-id entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- num
- message-id))
- (if (setq mark (or (elmo-msgdb-global-mark-get message-id)
- (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 mark)))
- (when (> len elmo-display-progress-threshold)
- (setq i (1+ i))
- (elmo-display-progress
- 'elmo-cache-folder-msgdb-create "Creating msgdb..."
- (/ (* i 100) len))))
+ (setq mark (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity mark))
+ (when (> len elmo-display-progress-threshold)
+ (setq i (1+ i))
+ (elmo-display-progress
+ 'elmo-cache-folder-msgdb-create "Creating msgdb..."
+ (/ (* i 100) len)))
(setq numbers (cdr numbers)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist)))
+ new-msgdb))
(luna-define-method elmo-folder-append-buffer ((folder elmo-cache-folder)
&optional flag number)
(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 mark)
+ (new-msgdb (elmo-make-msgdb))
+ message-id entity mark)
(when (> len elmo-display-progress-threshold)
(elmo-progress-set 'elmo-folder-msgdb-create
len "Creating msgdb..."))
(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))
- (when (setq mark (elmo-msgdb-get-mark msgdb number))
- (setq mark-alist (elmo-msgdb-mark-append
- mark-alist
- number
- mark))))
+ (setq mark (elmo-msgdb-get-mark msgdb number))
+ (elmo-msgdb-append-entity new-msgdb entity mark))
(elmo-progress-notify 'elmo-folder-msgdb-create))
(elmo-progress-clear 'elmo-folder-msgdb-create))
- (list overview number-alist mark-alist))
+ new-msgdb)
;; Does not require msgdb.
(elmo-folder-msgdb-create
(elmo-filter-folder-target-internal folder)
(if elmo-imap4-use-cache
elmo-msgdb-read-uncached-mark))
elmo-msgdb-new-mark))))))
- (setq elmo-imap4-current-msgdb
- (elmo-msgdb-append
- elmo-imap4-current-msgdb
- (list (list entity)
- (list (cons (elmo-msgdb-overview-entity-get-number entity)
- (car entity)))
- (if mark
- (list
- (list (elmo-msgdb-overview-entity-get-number entity)
- mark))))))))
+ (elmo-msgdb-append-entity elmo-imap4-current-msgdb
+ entity
+ mark)))
;; Current buffer is process buffer.
(defun elmo-imap4-fetch-callback-1 (element app-data)
elmo-imap4-overview-fetch-chop-length))
;; Setup callback.
(with-current-buffer (elmo-network-session-buffer session)
- (setq elmo-imap4-current-msgdb nil
+ (setq elmo-imap4-current-msgdb (elmo-make-msgdb)
elmo-imap4-seen-messages nil
elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1
elmo-imap4-fetch-callback-data (cons flag-table
flag-table)
(when numbers
(let ((dir (elmo-localdir-folder-directory-internal folder))
- overview number-alist mark-alist entity message-id
- num gmark
+ (new-msgdb (elmo-make-msgdb))
+ entity message-id gmark
(i 0)
(len (length numbers)))
(message "Creating msgdb...")
(setq entity
(elmo-localdir-msgdb-create-entity
dir (car numbers)))
- (if (null entity)
- ()
- (setq num (elmo-msgdb-overview-entity-get-number entity))
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
+ (when entity
(setq message-id (elmo-msgdb-overview-entity-get-id entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- num
- message-id))
- (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (unless (eq 'read (elmo-flag-table-get
- flag-table message-id))
- (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))))
+ (setq gmark (or (elmo-msgdb-global-mark-get message-id)
+ (unless (eq 'read (elmo-flag-table-get
+ flag-table message-id))
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new))))
+ (elmo-msgdb-append-entity new-msgdb entity gmark))
(when (> len elmo-display-progress-threshold)
(setq i (1+ i))
(elmo-display-progress
(/ (* i 100) len)))
(setq numbers (cdr numbers)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist))))
+ new-msgdb)))
(luna-define-method elmo-folder-list-subfolders ((folder elmo-localdir-folder)
&optional one-level)
(answered-list (elmo-maildir-folder-answered-locations-internal
folder))
(len (length numbers))
+ (new-msgdb (elmo-make-msgdb))
(i 0)
- overview number-alist mark-alist entity message-id flag
+ entity message-id flag
file location pair mark cache-status file-flag)
(message "Creating msgdb...")
(dolist (number numbers)
(setq file
(elmo-maildir-message-file-name folder location))))
(when entity
- (setq overview
- (elmo-msgdb-append-element overview entity)
- number-alist
- (elmo-msgdb-number-add number-alist
- (elmo-message-entity-number entity)
- (setq message-id
- (elmo-message-entity-field
- entity 'message-id)))
+ (setq message-id (elmo-message-entity-field
+ entity 'message-id)
;; Precede flag-table to file-info.
flag (elmo-flag-table-get flag-table message-id)
file-flag nil
- mark nil)
- (setq cache-status
+ mark nil
+ cache-status
(elmo-file-cache-status (elmo-file-cache-get message-id)))
;; Already flagged on filename (precede it to flag-table).
(delete location
(elmo-maildir-folder-unread-locations-internal
folder))))))
- (if mark
- (setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
- (elmo-msgdb-overview-entity-get-number
- entity)
- mark)))
+ (elmo-msgdb-append-entity new-msgdb entity mark)
(when (> len elmo-display-progress-threshold)
(setq i (1+ i))
(elmo-display-progress
'elmo-maildir-msgdb-create "Creating msgdb..."
(/ (* i 100) len)))))
(message "Creating msgdb...done")
- (elmo-msgdb-sort-by-date
- (list overview number-alist mark-alist))))
+ (elmo-msgdb-sort-by-date new-msgdb)))
(defun elmo-maildir-cleanup-temporal (dir)
;; Delete files in the tmp dir which are not accessed
(defun elmo-mark-folder-msgdb-create (folder numbers)
(let ((i 0)
(len (length numbers))
- overview number-alist mark-alist entity message-id
- num)
+ (new-msgdb (elmo-make-msgdb))
+ entity message-id)
(message "Creating msgdb...")
(while numbers
(setq entity
(elmo-msgdb-create-overview-entity-from-file
(car numbers) (elmo-message-file-name folder (car numbers))))
- (if (null entity)
- ()
- (setq num (elmo-msgdb-overview-entity-get-number entity))
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq message-id (elmo-msgdb-overview-entity-get-id entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- num
- message-id))
- (setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
- num (elmo-mark-folder-mark-internal folder))))
+ (when entity
+ (elmo-msgdb-append-entity new-msgdb
+ entity
+ (elmo-mark-folder-mark-internal folder)))
(when (> len elmo-display-progress-threshold)
(setq i (1+ i))
(elmo-display-progress
(/ (* i 100) len)))
(setq numbers (cdr numbers)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist)))
+ new-msgdb))
(luna-define-method elmo-folder-append-buffer ((folder elmo-mark-folder)
&optional flag number)
;; elmo-flag-table-get
;; elmo-flag-table-save
-;; elmo-msgdb-append-entity
-;; msgdb entity flag-table
+;; elmo-msgdb-append-entity MSGDB ENTITY MARK-OR-FLAGS
;; ENTITY elmo-msgdb-make-entity ARGS
;; VALUE elmo-msgdb-entity-field ENTITY
(elmo-msgdb-overview-load msgdb-or-path)
(elmo-msgdb-get-overview msgdb-or-path))))
+(defsubst elmo-msgdb-mark-to-flags (mark)
+ (append
+ (and (string= mark elmo-msgdb-new-mark)
+ '(new))
+ (and (string= mark elmo-msgdb-important-mark)
+ '(important))
+ (and (member mark (elmo-msgdb-unread-marks))
+ '(unread))
+ (and (member mark (elmo-msgdb-answered-marks))
+ '(answered))
+ (and (not (member mark (elmo-msgdb-uncached-marks)))
+ '(cached))))
+
+(defsubst elmo-msgdb-flags-to-mark (flags cached use-cache)
+ (cond ((memq 'new flags)
+ elmo-msgdb-new-mark)
+ ((memq 'important flags)
+ elmo-msgdb-important-mark)
+ ((memq 'answered flags)
+ (if cached
+ elmo-msgdb-answered-cached-mark
+ elmo-msgdb-answered-uncached-mark))
+ ((memq 'unread flags)
+ (if cached
+ elmo-msgdb-unread-cached-mark
+ elmo-msgdb-unread-uncached-mark))
+ (t
+ (if (or cached (not use-cache))
+ nil
+ elmo-msgdb-read-uncached-mark))))
+
(defsubst elmo-msgdb-get-mark (msgdb number)
"Get mark string from MSGDB which corresponds to the message with NUMBER."
(cadr (elmo-get-hash-val (format "#%d" number)
elmo-msgdb-unread-uncached-mark
elmo-msgdb-read-uncached-mark))))
+(defun elmo-msgdb-append-entity (msgdb entity &optional mark)
+ (when entity
+ (let ((number (elmo-msgdb-overview-entity-get-number entity))
+ (message-id (elmo-msgdb-overview-entity-get-id entity)))
+ (elmo-msgdb-set-overview
+ msgdb
+ (nconc (elmo-msgdb-get-overview msgdb)
+ (list entity)))
+ (elmo-msgdb-set-number-alist
+ msgdb
+ (nconc (elmo-msgdb-get-number-alist msgdb)
+ (list (cons number message-id))))
+ (when mark
+ (elmo-msgdb-set-mark-alist
+ msgdb
+ (nconc (elmo-msgdb-get-mark-alist msgdb)
+ (list (list number mark)))))
+ (elmo-msgdb-make-index
+ msgdb
+ (list entity)
+ (list (cons number mark))))))
+
(defsubst elmo-msgdb-get-number (msgdb message-id)
"Get number of the message which corrensponds to MESSAGE-ID from MSGDB."
(elmo-msgdb-overview-entity-get-number
(luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder)
numlist flag-table)
- (let* (overview number-alist mark-alist entity
- i percent num pair)
+ (let ((new-msgdb (elmo-make-msgdb))
+ entity mark i percent num)
(setq num (length numlist))
(setq i 0)
(message "Creating msgdb...")
(elmo-nmz-msgdb-create-entity
folder (car numlist)))
(when entity
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- (elmo-msgdb-overview-entity-get-number
- entity)
- (elmo-msgdb-overview-entity-get-id
- entity)))
- (setq mark-alist
- (elmo-msgdb-mark-append
- mark-alist
- (elmo-msgdb-overview-entity-get-number
- entity)
- (or (elmo-msgdb-global-mark-get
- (elmo-msgdb-overview-entity-get-id
- entity))
- elmo-msgdb-new-mark))))
+ (setq mark (or (elmo-msgdb-global-mark-get
+ (elmo-msgdb-overview-entity-get-id
+ entity))
+ elmo-msgdb-new-mark))
+ (elmo-msgdb-append-entity new-msgdb entity mark))
(when (> num elmo-display-progress-threshold)
(setq i (1+ i))
(setq percent (/ (* i 100) num))
percent))
(setq numlist (cdr numlist)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist)))
+ new-msgdb))
(luna-define-method elmo-folder-message-file-p ((folder elmo-nmz-folder))
t)
(defun elmo-nntp-create-msgdb-from-overview-string (str
flag-table
&optional numlist)
- (let (ov-list gmark message-id seen
- ov-entity overview number-alist mark-alist num
+ (let ((new-msgdb (elmo-make-msgdb))
+ ov-list gmark message-id entity
+ ov-entity num
extras extra ext field field-index)
(setq ov-list (elmo-nntp-parse-overview-string str))
(while ov-list
(setq field (elmo-msgdb-remove-field-string field)))
(setq extra (cons (cons ext field) extra))))
(setq extras (cdr extras)))
- (setq overview
- (elmo-msgdb-append-element
- overview
- (cons (aref ov-entity 4)
- (vector num
- (elmo-msgdb-get-last-message-id
- (aref ov-entity 5))
- ;; from
- (elmo-mime-string (elmo-delete-char
- ?\"
- (or
- (aref ov-entity 2)
- elmo-no-from) 'uni))
- ;; subject
- (elmo-mime-string (or (aref ov-entity 1)
- elmo-no-subject))
- (aref ov-entity 3) ;date
- nil ; to
- nil ; cc
- (string-to-int
- (aref ov-entity 6)) ; size
- extra ; extra-field-list
- ))))
- (setq number-alist
- (elmo-msgdb-number-add number-alist num
- (aref ov-entity 4)))
- (setq message-id (aref ov-entity 4))
- (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (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))))
+ (setq entity (elmo-msgdb-make-message-entity
+ :message-id (aref ov-entity 4)
+ :number num
+ :references (elmo-msgdb-get-last-message-id
+ (aref ov-entity 5))
+ :from (elmo-mime-string (elmo-delete-char
+ ?\"
+ (or
+ (aref ov-entity 2)
+ elmo-no-from) 'uni))
+ :subject (elmo-mime-string (or (aref ov-entity 1)
+ elmo-no-subject))
+ :date (aref ov-entity 3)
+ :size (string-to-int (aref ov-entity 6))
+ :extra extra))
+ (setq message-id (elmo-message-entity-field entity 'message-id))
+ (setq gmark (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark))
(setq ov-list (cdr ov-list)))
- (list overview number-alist mark-alist)))
+ new-msgdb))
(luna-define-method elmo-folder-msgdb-create ((folder elmo-nntp-folder)
numbers flag-table)
(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)
+ (let ((new-msgdb (elmo-make-msgdb))
+ beg overview number-alist mark-alist
+ entity i num gmark seen message-id)
(elmo-set-buffer-multibyte nil)
(goto-char (point-min))
(setq i 0)
(setq entity
(elmo-msgdb-create-overview-from-buffer num))
(when entity
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq number-alist
- (elmo-msgdb-number-add
- number-alist
- (elmo-msgdb-overview-entity-get-number entity)
- (car entity)))
- (setq message-id (car entity))
- (if (setq gmark
- (or (elmo-msgdb-global-mark-get message-id)
- (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)))
- ))))
+ (setq message-id
+ (elmo-message-entity-field entity 'message-id)
+ gmark
+ (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark)))))
(when (> len elmo-display-progress-threshold)
(setq i (1+ i))
(if (or (zerop (% i 20)) (= i len))
(when (> len elmo-display-progress-threshold)
(elmo-display-progress
'elmo-nntp-msgdb-create-message "Creating msgdb..." 100))
- (list overview number-alist mark-alist))))
+ new-msgdb)))
(luna-define-method elmo-message-use-cache-p ((folder elmo-nntp-folder) number)
elmo-nntp-use-cache)
(defun elmo-pop3-sort-msgdb-by-original-number (folder msgdb)
(message "Sorting...")
(let ((overview (elmo-msgdb-get-overview msgdb)))
- (setq overview (elmo-pop3-sort-overview-by-original-number
- overview
- (elmo-pop3-folder-location-alist-internal folder)))
+ (elmo-msgdb-set-overview
+ msgdb
+ (elmo-pop3-sort-overview-by-original-number
+ overview
+ (elmo-pop3-folder-location-alist-internal folder)))
(message "Sorting...done")
- (list overview (nth 1 msgdb)(nth 2 msgdb)(nth 3 msgdb))))
+ msgdb))
(defun elmo-pop3-uidl-to-number (uidl)
(string-to-number (elmo-get-hash-val uidl
flag-table
loc-alist)
(save-excursion
- (let (beg overview number-alist mark-alist
- entity i number message-id gmark seen size)
+ (let ((new-msgdb (elmo-make-msgdb))
+ beg entity i number message-id gmark)
(set-buffer buffer)
(elmo-set-buffer-multibyte default-enable-multibyte-characters)
(goto-char (point-min))
(car numlist)))
(setq numlist (cdr numlist))
(when entity
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
(with-current-buffer (process-buffer process)
(elmo-msgdb-overview-entity-set-size
entity
(elmo-msgdb-overview-entity-get-number entity))
loc-alist)))
(elmo-msgdb-overview-entity-set-number entity number)))
- (setq number-alist
- (elmo-msgdb-number-add
- number-alist
- (elmo-msgdb-overview-entity-get-number entity)
- (car entity)))
- (setq message-id (car entity))
- (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
- (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-msgdb-overview-entity-get-number entity)
- gmark))))))
+ (setq message-id (elmo-message-entity-field entity 'message-id))
+ (setq gmark (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark))))
(when (> num elmo-display-progress-threshold)
(setq i (1+ i))
(if (or (zerop (% i 5)) (= i num))
(elmo-display-progress
'elmo-pop3-msgdb-create-message "Creating msgdb..."
(/ (* i 100) num)))))
- (list overview number-alist mark-alist))))
+ new-msgdb)))
(defun elmo-pop3-read-body (process outbuf)
(with-current-buffer (process-buffer process)
numbers flag-table)
(let ((i 0)
(len (length numbers))
- overview number-alist mark-alist entity message-id
- num mark)
+ (new-msgdb (elmo-make-msgdb))
+ entity message-id mark)
(message "Creating msgdb...")
(while numbers
(setq entity
(nconc
(elmo-folder-killed-list-internal folder)
(list (car numbers))))
- (setq num (elmo-msgdb-overview-entity-get-number entity))
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
(setq message-id (elmo-msgdb-overview-entity-get-id entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- num
- message-id))
- (if (setq mark (or (elmo-msgdb-global-mark-get message-id)
- (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 mark)))
- (when (> len elmo-display-progress-threshold)
- (setq i (1+ i))
- (elmo-display-progress
- 'elmo-sendlog-folder-msgdb-create "Creating msgdb..."
- (/ (* i 100) len))))
+ (setq mark (or (elmo-msgdb-global-mark-get message-id)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table message-id)
+ (elmo-file-cache-status
+ (elmo-file-cache-get message-id))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity mark))
+ (when (> len elmo-display-progress-threshold)
+ (setq i (1+ i))
+ (elmo-display-progress
+ 'elmo-sendlog-folder-msgdb-create "Creating msgdb..."
+ (/ (* i 100) len)))
(setq numbers (cdr numbers)))
(message "Creating msgdb...done")
- (list overview number-alist mark-alist)))
+ new-msgdb))
(luna-define-method elmo-message-fetch-with-cache-process
((folder elmo-sendlog-folder) number strategy &optional section unseen)
(luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder)
numlist flag-table)
- (let* (overview number-alist mark-alist entity
- i percent number length pair msgid gmark seen)
+ (let ((new-msgdb (elmo-make-msgdb))
+ entity i percent length msgid gmark)
(setq length (length numlist))
(setq i 0)
(message "Creating msgdb...")
(elmo-shimbun-msgdb-create-entity
folder (car numlist)))
(when entity
- (setq overview
- (elmo-msgdb-append-element
- overview entity))
- (setq number (elmo-msgdb-overview-entity-get-number entity))
(setq msgid (elmo-msgdb-overview-entity-get-id entity))
- (setq number-alist
- (elmo-msgdb-number-add number-alist
- number msgid))
- (if (setq gmark (or (elmo-msgdb-global-mark-get msgid)
- (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))))
+ (setq gmark (or (elmo-msgdb-global-mark-get msgid)
+ (elmo-msgdb-mark
+ (elmo-flag-table-get flag-table msgid)
+ (elmo-file-cache-status
+ (elmo-file-cache-get msgid))
+ 'new)))
+ (elmo-msgdb-append-entity new-msgdb entity gmark))
(when (> length elmo-display-progress-threshold)
(setq i (1+ i))
(setq percent (/ (* i 100) length))
percent))
(setq numlist (cdr numlist)))
(message "Creating msgdb...done")
- (elmo-msgdb-sort-by-date
- (list overview number-alist mark-alist))))
+ (elmo-msgdb-sort-by-date new-msgdb)))
(luna-define-method elmo-folder-message-file-p ((folder elmo-shimbun-folder))
nil)