From 29fbdfaa0a89009f70f841a16a86f6faa1a2df4a Mon Sep 17 00:00:00 2001 From: hmurata Date: Fri, 5 Sep 2003 15:37:34 +0000 Subject: [PATCH] * elmo-shimbun.el (elmo-shimbun-folder-entity-hash): Use `elmo-folder-list-message-entities' instead of `elmo-msgdb-get-overview'. (elmo-map-folder-list-message-locations): Ditto. * elmo-msgdb.el (elmo-msgdb-append): Rewrite (use interface methods instead of treat directly). (elmo-msgdb-clear): Ditto. (elmo-msgdb-delete-msgs): Ditto. (elmo-msgdb-sort-by-date): Ditto. * elmo-nntp.el (elmo-nntp-msgdb-create-message): Removed unused local variables. (elmo-nntp-folder-msgdb-create): Follow the API change. --- elmo/ChangeLog | 15 ++++++++++++ elmo/elmo-msgdb.el | 62 +++++++++++++++++++++++++++++++------------------- elmo/elmo-nntp.el | 43 ++++++++++++++++------------------ elmo/elmo-shimbun.el | 4 ++-- 4 files changed, 76 insertions(+), 48 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 1c4441b..2c8db2d 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,20 @@ 2003-09-05 Hiroya Murata + * elmo-shimbun.el (elmo-shimbun-folder-entity-hash): Use + `elmo-folder-list-message-entities' instead of + `elmo-msgdb-get-overview'. + (elmo-map-folder-list-message-locations): Ditto. + + * elmo-msgdb.el (elmo-msgdb-append): Rewrite (use interface + methods instead of treat directly). + (elmo-msgdb-clear): Ditto. + (elmo-msgdb-delete-msgs): Ditto. + (elmo-msgdb-sort-by-date): Ditto. + + * elmo-nntp.el (elmo-nntp-msgdb-create-message): Removed unused + local variables. + (elmo-nntp-folder-msgdb-create): Follow the API change. + * elmo-version.el (elmo-version): Up to 2.11.10. 2003-08-30 Hiroya Murata diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 13b101d..fc66b2b 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -445,16 +445,30 @@ FLAG is a symbol which is one of the following: (elmo-msgdb-overview-get-entity number msgdb))))) -(defsubst elmo-msgdb-append (msgdb msgdb-append) - (list - (nconc (car msgdb) (car msgdb-append)) - (nconc (cadr msgdb) (cadr msgdb-append)) - (nconc (caddr msgdb) (caddr msgdb-append)) - (elmo-msgdb-make-index-return - msgdb - (elmo-msgdb-get-overview msgdb-append) - (elmo-msgdb-get-mark-alist msgdb-append)) - (nth 4 msgdb))) +(defun elmo-msgdb-append (msgdb msgdb-append) + "Return a list of messages which have duplicated message-id." + (let (duplicates) + (elmo-msgdb-set-overview + msgdb + (nconc (elmo-msgdb-get-overview msgdb) + (elmo-msgdb-get-overview msgdb-append))) + (elmo-msgdb-set-number-alist + msgdb + (nconc (elmo-msgdb-get-number-alist msgdb) + (elmo-msgdb-get-number-alist msgdb-append))) + (elmo-msgdb-set-mark-alist + msgdb + (nconc (elmo-msgdb-get-mark-alist msgdb) + (elmo-msgdb-get-mark-alist msgdb-append))) + (setq duplicates (elmo-msgdb-make-index + msgdb + (elmo-msgdb-get-overview msgdb-append) + (elmo-msgdb-get-mark-alist msgdb-append))) + (elmo-msgdb-set-path + msgdb + (or (elmo-msgdb-get-path msgdb) + (elmo-msgdb-get-path msgdb-append))) + duplicates)) (defun elmo-msgdb-merge (folder msgdb-merge) "Return a list of messages which have duplicated message-id." @@ -487,13 +501,13 @@ FLAG is a symbol which is one of the following: (defsubst elmo-msgdb-clear (&optional msgdb) (if msgdb - (list - (setcar msgdb nil) - (setcar (cdr msgdb) nil) - (setcar (cddr msgdb) nil) - (setcar (nthcdr 3 msgdb) nil) - (setcar (nthcdr 4 msgdb) nil)) - (list nil nil nil nil nil))) + (progn + (elmo-msgdb-set-overview msgdb nil) + (elmo-msgdb-set-number-alist msgdb nil) + (elmo-msgdb-set-mark-alist msgdb nil) + (elmo-msgdb-set-index msgdb nil) + msgdb) + (elmo-make-msgdb))) (defun elmo-msgdb-delete-msgs (msgdb msgs) "Delete MSGS from MSGDB @@ -517,18 +531,20 @@ content of MSGDB is changed." ;; (when index (elmo-msgdb-clear-index msgdb ov-entity)) (setq msgs (cdr msgs))) - (setcar msgdb overview) - (setcar (cdr msgdb) number-alist) - (setcar (cddr msgdb) mark-alist) - (setcar (nthcdr 3 msgdb) index) + (elmo-msgdb-set-overview msgdb overview) + (elmo-msgdb-set-number-alist msgdb number-alist) + (elmo-msgdb-set-mark-alist msgdb mark-alist) + (elmo-msgdb-set-index msgdb index) t)) ;return value (defun elmo-msgdb-sort-by-date (msgdb) (message "Sorting...") (let ((overview (elmo-msgdb-get-overview msgdb))) - (setq overview (elmo-msgdb-overview-sort-by-date overview)) + (elmo-msgdb-set-overview + msgdb + (elmo-msgdb-overview-sort-by-date overview)) (message "Sorting...done") - (list overview (nth 1 msgdb)(nth 2 msgdb)))) + msgdb)) ;;; (defsubst elmo-msgdb-append-element (list element) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 4a3958a..11f2411 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -796,8 +796,9 @@ Don't cache if nil.") (defun elmo-nntp-folder-msgdb-create (folder numbers flag-table) (let ((filter numbers) (session (elmo-nntp-get-session folder)) + (new-msgdb (elmo-make-msgdb)) beg-num end-num cur length - ret-val ov-str use-xover dir) + new-msgdb ov-str use-xover dir) (elmo-nntp-select-group session (elmo-nntp-folder-group-internal folder)) (when (setq use-xover (elmo-nntp-xover-p session)) @@ -817,14 +818,12 @@ Don't cache if nil.") elmo-nntp-overview-fetch-chop-length)))) (with-current-buffer (elmo-network-session-buffer session) (if ov-str - (setq ret-val - (elmo-msgdb-append - ret-val - (elmo-nntp-create-msgdb-from-overview-string - ov-str - flag-table - filter - ))))) + (elmo-msgdb-append + new-msgdb + (elmo-nntp-create-msgdb-from-overview-string + ov-str + flag-table + filter)))) (if (null (elmo-nntp-read-response session t)) (progn (setq cur end-num);; exit while loop @@ -842,24 +841,23 @@ Don't cache if nil.") (elmo-display-progress 'elmo-nntp-msgdb-create "Getting overview..." 100))) (if (not use-xover) - (setq ret-val (elmo-nntp-msgdb-create-by-header - session numbers flag-table)) + (setq new-msgdb (elmo-nntp-msgdb-create-by-header + session numbers flag-table)) (with-current-buffer (elmo-network-session-buffer session) (if ov-str - (setq ret-val - (elmo-msgdb-append - ret-val - (elmo-nntp-create-msgdb-from-overview-string - ov-str - flag-table - filter)))))) + (elmo-msgdb-append + new-msgdb + (elmo-nntp-create-msgdb-from-overview-string + ov-str + flag-table + filter))))) (elmo-folder-set-killed-list-internal folder (nconc (elmo-folder-killed-list-internal folder) (car (elmo-list-diff numbers - (elmo-msgdb-list-messages ret-val))))) + (elmo-msgdb-list-messages new-msgdb))))) ;; If there are canceled messages, overviews are not obtained ;; to max-number(inn 2.3?). (when (and (elmo-nntp-max-number-precedes-list-active-p) @@ -873,10 +871,10 @@ Don't cache if nil.") (elmo-nntp-set-list-active session nil) (error "NNTP list command failed"))) (elmo-nntp-catchup-msgdb - ret-val + new-msgdb (nth 1 (read (concat "(" (elmo-nntp-read-contents session) ")"))))) - ret-val)) + new-msgdb)) (luna-define-method elmo-folder-update-number ((folder elmo-nntp-folder)) (if (elmo-nntp-max-number-precedes-list-active-p) @@ -1395,8 +1393,7 @@ Returns a list of cons cells like (NUMBER . VALUE)" (defun elmo-nntp-msgdb-create-message (len flag-table) (save-excursion (let ((new-msgdb (elmo-make-msgdb)) - beg overview number-alist mark-alist - entity i num gmark seen message-id) + beg entity i num gmark message-id) (elmo-set-buffer-multibyte nil) (goto-char (point-min)) (setq i 0) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index cecef52..33ca723 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -105,7 +105,7 @@ update overview when message is fetched." (defun elmo-shimbun-folder-entity-hash (folder) (or (elmo-shimbun-folder-entity-hash-internal folder) - (let ((overviews (elmo-msgdb-get-overview (elmo-folder-msgdb folder))) + (let ((overviews (elmo-folder-list-message-entities folder)) hash id) (when overviews (setq hash (elmo-make-hash (length overviews))) @@ -473,7 +473,7 @@ update overview when message is fetched." )) t)) (elmo-msgdb-overview-entity-get-id ov))) - (elmo-msgdb-get-overview (elmo-folder-msgdb folder)))) + (elmo-folder-list-message-entities folder))) (mapcar (lambda (header) (or (elmo-shimbun-header-extra-field header "x-shimbun-id") -- 1.7.10.4