From: hmurata Date: Sun, 7 Sep 2003 07:13:41 +0000 (+0000) Subject: * elmo.el (elmo-folder-list-messages): Append killed messages into X-Git-Tag: wl-2_11_11~5 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6bf0a890856eda633244a31aed97412e10d978fc;p=elisp%2Fwanderlust.git * elmo.el (elmo-folder-list-messages): Append killed messages into result if `visible-only' is nil. * elmo-nntp.el (elmo-nntp-catchup-msgdb): Return a list of canceled messages. (elmo-nntp-folder-msgdb-create): Kill messages which already canceled. (elmo-folder-update-number): Likewise. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index dd4a679..878be7f 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,13 @@ 2003-09-07 Hiroya Murata + * elmo.el (elmo-folder-list-messages): Append killed messages into + result if `visible-only' is nil. + + * elmo-nntp.el (elmo-nntp-catchup-msgdb): Return a list of + canceled messages. + (elmo-nntp-folder-msgdb-create): Kill messages which already canceled. + (elmo-folder-update-number): Likewise. + * elmo-pop3.el (elmo-pop3-sort-overview-by-original-number): Abolish. (elmo-pop3-sort-msgdb-by-original-number): Use `elmo-msgdb-sort-entities'. diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 11f2411..802bd29 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -463,16 +463,20 @@ Don't cache if nil.") ))))) (defsubst elmo-nntp-catchup-msgdb (msgdb max-number) - (let (msgdb-max number-alist) - (setq number-alist (elmo-msgdb-get-number-alist msgdb)) - (setq msgdb-max (car (nth (max (- (length number-alist) 1) 0) - number-alist))) - (if (or (not msgdb-max) - (and msgdb-max max-number - (< msgdb-max max-number))) - (elmo-msgdb-set-number-alist - msgdb - (nconc number-alist (list (cons max-number nil))))))) + (let ((numbers (elmo-msgdb-list-messages msgdb)) + msgdb-max) + (setq msgdb-max (if numbers + (car (sort numbers '>)) + 0)) + (when (and msgdb-max + max-number + (< msgdb-max max-number)) + (let ((i (1+ msgdb-max)) + killed) + (while (<= i max-number) + (setq killed (cons i killed)) + (incf i)) + (nreverse killed))))) (luna-define-method elmo-folder-list-subfolders ((folder elmo-nntp-folder) &optional one-level) @@ -870,42 +874,45 @@ Don't cache if nil.") (progn (elmo-nntp-set-list-active session nil) (error "NNTP list command failed"))) - (elmo-nntp-catchup-msgdb - new-msgdb - (nth 1 (read (concat "(" (elmo-nntp-read-contents - session) ")"))))) + (let ((killed (elmo-nntp-catchup-msgdb + new-msgdb + (nth 1 (read (concat "(" (elmo-nntp-read-contents + session) ")")))))) + (when killed + (elmo-folder-kill-messages folder killed)))) new-msgdb)) (luna-define-method elmo-folder-update-number ((folder elmo-nntp-folder)) - (if (elmo-nntp-max-number-precedes-list-active-p) - (let ((session (elmo-nntp-get-session folder)) - (number-alist (elmo-msgdb-get-number-alist - (elmo-folder-msgdb folder)))) - (if (elmo-nntp-list-active-p session) - (let (msgdb-max max-number) - ;; If there are canceled messages, overviews are not obtained - ;; to max-number(inn 2.3?). - (elmo-nntp-select-group session - (elmo-nntp-folder-group-internal folder)) - (elmo-nntp-send-command session - (format "list active %s" - (elmo-nntp-folder-group-internal - folder))) - (if (null (elmo-nntp-read-response session)) - (error "NNTP list command failed")) - (setq max-number - (nth 1 (read (concat "(" (elmo-nntp-read-contents - session) ")")))) - (setq msgdb-max - (car (nth (max (- (length number-alist) 1) 0) - number-alist))) - (if (or (and number-alist (not msgdb-max)) - (and msgdb-max max-number - (< msgdb-max max-number))) - (elmo-msgdb-set-number-alist - (elmo-folder-msgdb folder) - (nconc number-alist - (list (cons max-number nil)))))))))) + (when (elmo-nntp-max-number-precedes-list-active-p) + (let ((session (elmo-nntp-get-session folder))) + (when (elmo-nntp-list-active-p session) + (let ((numbers (elmo-folder-list-messages folder nil 'in-msgdb)) + msgdb-max max-number) + ;; If there are canceled messages, overviews are not obtained + ;; to max-number(inn 2.3?). + (elmo-nntp-select-group session + (elmo-nntp-folder-group-internal folder)) + (elmo-nntp-send-command session + (format "list active %s" + (elmo-nntp-folder-group-internal + folder))) + (if (null (elmo-nntp-read-response session)) + (error "NNTP list command failed")) + (setq max-number + (nth 1 (read (concat "(" (elmo-nntp-read-contents + session) ")")))) + (setq msgdb-max (if numbers + (car (sort numbers '>)) + 0)) + (when (and msgdb-max + max-number + (< msgdb-max max-number)) + (let ((i (1+ msgdb-max)) + killed) + (while (<= i max-number) + (setq killed (cons i killed)) + (incf i)) + (elmo-folder-kill-messages folder (nreverse killed))))))))) (defun elmo-nntp-msgdb-create-by-header (session numbers flag-table) (with-temp-buffer diff --git a/elmo/elmo.el b/elmo/elmo.el index 9f5e2e1..243194e 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -216,19 +216,20 @@ Return value is cons cell or list: "Return a list of message numbers contained in FOLDER. If optional VISIBLE-ONLY is non-nil, killed messages are not listed. If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed.") + (luna-define-method elmo-folder-list-messages ((folder elmo-folder) &optional visible-only in-msgdb) (let ((list (if in-msgdb t - (elmo-folder-list-messages-internal folder visible-only)))) - (setq list - (if (listp list) - list - ;; Use current list. - (elmo-msgdb-list-messages (elmo-folder-msgdb folder)))) + (elmo-folder-list-messages-internal folder visible-only))) + (killed-list (elmo-folder-killed-list-internal folder))) + (unless (listp list) + ;; Use current list. + (setq list (elmo-msgdb-list-messages (elmo-folder-msgdb folder)))) (if visible-only - (elmo-living-messages list (elmo-folder-killed-list-internal folder)) - list))) + (elmo-living-messages list killed-list) + (elmo-uniq-list + (nconc (elmo-number-set-to-number-list killed-list) list))))) (luna-define-generic elmo-folder-list-unreads (folder) "Return a list of unread message numbers contained in FOLDER.")