From 3cc39e5094cb6b11331d80dd6ac38fb3b8c73ae7 Mon Sep 17 00:00:00 2001 From: teranisi Date: Tue, 11 Jul 2000 00:53:56 +0000 Subject: [PATCH] * elmo2.el (elmo-move-msgs): Don't move message when buffer-size is 0. * elmo-nntp.el (elmo-nntp-delete-msgs): Check the value of `elmo-nntp-use-killed-list'. (elmo-nntp-list-folder): Use killed list. (elmo-nntp-max-of-folder): Ditto. (elmo-nntp-msgdb-create): Set killed list. * elmo-vars.el (elmo-nntp-use-killed-list): New user option. * elmo2.el (elmo-clear-killed): New backend function. All other related modules are changed. --- elmo/ChangeLog | 15 ++++++ elmo/elmo-archive.el | 1 + elmo/elmo-cache.el | 1 + elmo/elmo-filter.el | 5 +- elmo/elmo-imap4.el | 4 +- elmo/elmo-internal.el | 3 +- elmo/elmo-localdir.el | 3 +- elmo/elmo-localnews.el | 3 +- elmo/elmo-maildir.el | 3 +- elmo/elmo-multi.el | 5 +- elmo/elmo-nntp.el | 131 +++++++++++++++++++++++++++++++----------------- elmo/elmo-pipe.el | 5 +- elmo/elmo-vars.el | 6 ++- elmo/elmo2.el | 24 ++++++--- 14 files changed, 146 insertions(+), 63 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8f64114..920ccc7 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,18 @@ +2000-07-11 Yuuichi Teranishi + + * elmo2.el (elmo-move-msgs): Don't move message when buffer-size is 0. + + * elmo-nntp.el (elmo-nntp-delete-msgs): Check the value of + `elmo-nntp-use-killed-list'. + (elmo-nntp-list-folder): Use killed list. + (elmo-nntp-max-of-folder): Ditto. + (elmo-nntp-msgdb-create): Set killed list. + + * elmo-vars.el (elmo-nntp-use-killed-list): New user option. + + * elmo2.el (elmo-clear-killed): New backend function. + All other related modules are changed. + 2000-07-07 OKAZAKI Tetsurou * elmo-util.el (elmo-imap4-spec-folder): Use diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 887f8d6..405422a 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -1053,6 +1053,7 @@ TYPE specifies the archiver's symbol." (defalias 'elmo-archive-list-folder-important 'elmo-generic-list-folder-important) (defalias 'elmo-archive-commit 'elmo-generic-commit) +(defalias 'elmo-archive-clear-killed 'elmo-generic-clear-killed) ;;; End (run-hooks 'elmo-archive-load-hook) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 100e4e0..294f9b4 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -739,6 +739,7 @@ Returning its cache buffer." (defalias 'elmo-cache-list-folder-important 'elmo-generic-list-folder-important) (defalias 'elmo-cache-commit 'elmo-generic-commit) +(defalias 'elmo-cache-clear-killed 'elmo-cache-clear-killed) (provide 'elmo-cache) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 3446140..7b39bb2 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/03/13 18:58:42 teranisi> +;; Time-stamp: <00/07/10 17:55:56 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -175,6 +175,9 @@ (defun elmo-filter-commit (spec) (elmo-commit (nth 2 spec))) +(defun elmo-filter-clear-killed (spec) + (elmo-clear-killed (nth 2 spec))) + (defun elmo-filter-plugged-p (spec) (elmo-folder-plugged-p (nth 2 spec))) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index f9cbde3..5ed6af2 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/03/14 19:40:38 teranisi> +;; Time-stamp: <00/07/10 17:52:16 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -1584,6 +1584,8 @@ Return nil if connection failed." (defalias 'elmo-imap4-sync-number-alist 'elmo-generic-sync-number-alist) +(defalias 'elmo-imap4-clear-killed 'elmo-generic-clear-killed) + (provide 'elmo-imap4) ;;; elmo-imap4.el ends here diff --git a/elmo/elmo-internal.el b/elmo/elmo-internal.el index 3624e67..b8db73e 100644 --- a/elmo/elmo-internal.el +++ b/elmo/elmo-internal.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-03-03 11:12:17 teranisi> +;; Time-stamp: <00/07/10 17:57:16 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -258,6 +258,7 @@ (defalias 'elmo-internal-list-folder-important 'elmo-generic-list-folder-important) (defalias 'elmo-internal-commit 'elmo-generic-commit) +(defalias 'elmo-internal-clear-killed 'elmo-generic-clear-killed) (provide 'elmo-internal) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index d455262..5b72a05 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-05-18 17:09:15 teranisi> +;; Time-stamp: <00/07/10 17:52:07 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -462,6 +462,7 @@ (defalias 'elmo-localdir-list-folder-important 'elmo-generic-list-folder-important) (defalias 'elmo-localdir-commit 'elmo-generic-commit) +(defalias 'elmo-localdir-clear-killed 'elmo-generic-clear-killed) (provide 'elmo-localdir) diff --git a/elmo/elmo-localnews.el b/elmo/elmo-localnews.el index 67a3a6a..b0256e7 100644 --- a/elmo/elmo-localnews.el +++ b/elmo/elmo-localnews.el @@ -4,7 +4,7 @@ ;; Yuuichi Teranishi ;; Author: OKUNISHI Fujikazu -;; Time-stamp: <2000-01-24 12:20:07 teranisi> +;; Time-stamp: <00/07/10 17:57:30 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -127,6 +127,7 @@ (defalias 'elmo-localnews-list-folder-important 'elmo-generic-list-folder-important) (defalias 'elmo-localnews-commit 'elmo-generic-commit) +(defalias 'elmo-localnews-clear-killed 'elmo-generic-clear-killed) (provide 'elmo-localnews) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 32e1bf6..1e5f9e0 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/04/24 10:19:24 teranisi> +;; Time-stamp: <00/07/10 17:57:40 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -474,6 +474,7 @@ file name for maildir directories." 'elmo-generic-list-folder-unread) (defalias 'elmo-maildir-list-folder-important 'elmo-generic-list-folder-important) +(defalias 'elmo-maildir-clear-killed 'elmo-generic-clear-killed) (provide 'elmo-maildir) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index afa7669..60cdced 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/03/14 19:41:07 teranisi> +;; Time-stamp: <00/07/10 17:54:06 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -316,6 +316,9 @@ (defun elmo-multi-commit (spec) (mapcar 'elmo-commit (cdr spec))) +(defun elmo-multi-clear-killed (spec) + (mapcar 'elmo-clear-killed (cdr spec))) + (defun elmo-multi-plugged-p (spec) (let* ((flds (cdr spec))) (catch 'plugged diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 2fa6b64..7eea4bf 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/04/28 10:30:51 teranisi> +;; Time-stamp: <00/07/11 09:46:12 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -469,43 +469,54 @@ Don't cache if nil.") (defun elmo-nntp-list-folder (spec) (elmo-nntp-setting spec - (let* ((server (format "%s" server)) ;; delete text property - response retval use-listgroup) - (save-excursion - (when (setq use-listgroup (elmo-nntp-listgroup-p server port)) - (elmo-nntp-send-command buffer - process - (format "listgroup %s" folder)) - (if (not (elmo-nntp-read-response buffer process t)) - (progn - (elmo-nntp-set-listgroup server port nil) - (setq use-listgroup nil)) - (if (null (setq response (elmo-nntp-read-contents buffer process))) - (error "Fetching listgroup failed")) - (setq retval (elmo-string-to-list response)))) - (if use-listgroup - retval - (elmo-nntp-send-command buffer - process - (format "group %s" folder)) - (if (null (setq response (elmo-nntp-read-response buffer process))) - (error "Select folder failed")) - (setcar (cddr connection) folder) - (if (and - (string-match "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" - response) - (> (string-to-int (elmo-match-string 1 response)) 0)) - (elmo-nntp-make-msglist - (elmo-match-string 2 response) - (elmo-match-string 3 response)) - nil)))))) + (let* ((server (format "%s" server)) ;; delete text property + (killed (and elmo-nntp-use-killed-list + (elmo-msgdb-killed-list-load + (elmo-msgdb-expand-path nil spec)))) + response numbers use-listgroup) + (save-excursion + (when (setq use-listgroup (elmo-nntp-listgroup-p server port)) + (elmo-nntp-send-command buffer + process + (format "listgroup %s" folder)) + (if (not (elmo-nntp-read-response buffer process t)) + (progn + (elmo-nntp-set-listgroup server port nil) + (setq use-listgroup nil)) + (if (null (setq response (elmo-nntp-read-contents buffer process))) + (error "Fetching listgroup failed")) + (setq numbers (elmo-string-to-list response)))) + (unless use-listgroup + (elmo-nntp-send-command buffer + process + (format "group %s" folder)) + (if (null (setq response (elmo-nntp-read-response buffer process))) + (error "Select folder failed")) + (setcar (cddr connection) folder) + (if (and + (string-match + "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" + response) + (> (string-to-int (elmo-match-string 1 response)) 0)) + (setq numbers (elmo-nntp-make-msglist + (elmo-match-string 2 response) + (elmo-match-string 3 response))))) + (delq nil + (mapcar (lambda (number) + (unless (memq number killed) + number)) + numbers)))))) (defun elmo-nntp-max-of-folder (spec) (let* ((port (elmo-nntp-spec-port spec)) (user (elmo-nntp-spec-username spec)) (server (elmo-nntp-spec-hostname spec)) (ssl (elmo-nntp-spec-ssl spec)) - (folder (elmo-nntp-spec-group spec))) + (folder (elmo-nntp-spec-group spec)) + (dir (elmo-msgdb-expand-path nil spec)) + (killed-list (and elmo-nntp-use-killed-list + (elmo-msgdb-killed-list-load dir))) + number-alist) (if elmo-nntp-groups-async (let* ((fld (concat folder (elmo-nntp-folder-postfix user server port ssl))) @@ -534,6 +545,20 @@ Don't cache if nil.") (elmo-match-string 3 response))) (setq e-num (string-to-int (elmo-match-string 1 response))) + (when (and killed-list elmo-nntp-use-killed-list) + (setq killed-list (nreverse (sort killed-list '<))) + (cond + ;; XXX biggest number in server is killed, + ;; so max number is unknown (treated as no unsync). + ((eq end-num (car killed-list)) + (setq end-num nil)) + ;; killed number is obsolete. + ((< end-num (car killed-list)) + (while killed-list + (when (>= end-num (car killed-list)) + (elmo-msgdb-killed-list-save dir killed-list) + (setq killed-list nil)) + (setq killed-list (cdr killed-list)))))) (cons end-num e-num)) (if (null response) (error "Selecting newsgroup \"%s\" failed" folder) @@ -643,7 +668,7 @@ Don't cache if nil.") (let* ((cwf (caddr connection)) (filter (and as-num numlist)) beg-num end-num cur length - ret-val ov-str use-xover) + ret-val ov-str use-xover dir) (if (and folder (not (string= cwf folder)) (null (elmo-nntp-goto-folder server folder user port ssl))) @@ -711,6 +736,17 @@ Don't cache if nil.") important-mark seen-list filter)))))) + (when elmo-nntp-use-killed-list + (setq dir (elmo-msgdb-expand-path nil spec)) + (elmo-msgdb-killed-list-save + dir + (nconc + (elmo-msgdb-killed-list-load dir) + (car (elmo-list-diff + numlist + (mapcar 'car + (elmo-msgdb-get-number-alist + ret-val))))))) ;; 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) @@ -853,7 +889,7 @@ Returns message string." (setq errmsg "Fetching message failed") (set-buffer outbuf) (erase-buffer) - (insert "\n\n") + ;(insert "\n\n") (throw 'done nil))) (setq response (elmo-nntp-read-body buffer process outbuf)) (set-buffer outbuf) @@ -1044,18 +1080,20 @@ Return nil if connection failed." (elmo-nntp-send-data-line process sending-data)))) +(defun elmo-nntp-clear-killed (spec) + (elmo-msgdb-killed-list-save (elmo-msgdb-expand-path nil spec) nil)) (defun elmo-nntp-delete-msgs (spec msgs) "MSGS on FOLDER at SERVER pretended as Deleted. Returns nil if failed." - (let* ((dir (elmo-msgdb-expand-path nil spec)) -; (msgs (mapcar 'string-to-int msgs)) - (killed-list (elmo-msgdb-killed-list-load dir))) - (mapcar '(lambda (msg) - (setq killed-list - (elmo-msgdb-set-as-killed killed-list msg))) - msgs) - (elmo-msgdb-killed-list-save dir killed-list) - t)) + (if elmo-nntp-use-killed-list + (let* ((dir (elmo-msgdb-expand-path nil spec)) + (killed-list (elmo-msgdb-killed-list-load dir))) + (mapcar '(lambda (msg) + (setq killed-list + (elmo-msgdb-set-as-killed killed-list msg))) + msgs) + (elmo-msgdb-killed-list-save dir killed-list))) + t) (defun elmo-nntp-check-validity (spec validity-file) t) @@ -1300,9 +1338,10 @@ Return nil if connection failed." (elmo-msgdb-append-element overview entity)) (setq number-alist - (elmo-msgdb-number-add number-alist - (elmo-msgdb-overview-entity-get-number entity) - (car entity))) + (elmo-msgdb-number-add + number-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 diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index a6d1c8f..9415523 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-03-03 14:06:56 teranisi> +;; Time-stamp: <00/07/10 17:58:38 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -116,6 +116,9 @@ (elmo-commit (elmo-pipe-spec-src spec)) (elmo-commit (elmo-pipe-spec-dst spec))) +(defun elmo-pipe-clear-killed (spec) + (elmo-clear-killed (elmo-pipe-spec-src spec))) + (defun elmo-pipe-plugged-p (spec) (and (elmo-folder-plugged-p (elmo-pipe-spec-src spec)) (elmo-folder-plugged-p (elmo-pipe-spec-dst spec)))) diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index 11bc772..a133b84 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <00/05/10 10:15:20 teranisi> +;; Time-stamp: <00/07/10 10:35:15 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -325,6 +325,10 @@ If function, return value of function.") "Non-nil means max number of msgdb is set as the max number of `list active'. (Needed for inn 2.3 or later?).") +(defvar elmo-nntp-use-killed-list t + "If non-nil, deleted messages are saved as `killed' +and do not appear again.") + (defvar elmo-pop3-send-command-synchronously nil "If non-nil, commands are send synchronously. If server doesn't accept asynchronous commands, this variable should be diff --git a/elmo/elmo2.el b/elmo/elmo2.el index 98bb4b5..ecfbe9b 100644 --- a/elmo/elmo2.el +++ b/elmo/elmo2.el @@ -4,7 +4,7 @@ ;; Author: Yuuichi Teranishi ;; Keywords: mail, net news -;; Time-stamp: <2000-05-18 17:49:09 teranisi> +;; Time-stamp: <00/07/10 20:24:29 teranisi> ;; This file is part of ELMO (Elisp Library for Message Orchestration). @@ -237,7 +237,8 @@ without cacheing." (if (setq ret-val (elmo-call-func (car real-fld-num) "read-msg" (cdr real-fld-num) outbuf)) - (if (and (not (elmo-local-file-p folder msg)) + (if (and message-id + (not (elmo-local-file-p folder msg)) (elmo-use-cache-p folder msg)) (elmo-cache-save message-id (elmo-string-partial-p ret-val) @@ -329,12 +330,13 @@ without cacheing." (not (eq pair (rassoc message-id number-alist))))))) - (unless (elmo-append-msg dst-folder (buffer-string) message-id - (if same-number (car messages)) - ;; null means all unread. - (or (null unread-marks) - unseen)) - (error "move: append message to %s failed" dst-folder)))) + (unless (eq (buffer-size) 0) + (unless (elmo-append-msg dst-folder (buffer-string) message-id + (if same-number (car messages)) + ;; null means all unread. + (or (null unread-marks) + unseen)) + (error "move: append message to %s failed" dst-folder))))) ;; delete src cache if it is partial. (elmo-cache-delete-partial message-id src-folder (car messages)) (setq ret-val (nconc ret-val (list (car messages)))) @@ -583,6 +585,9 @@ without cacheing." (car x)))) mark-alist))) +(defun elmo-generic-clear-killed (spec) + nil) + (defun elmo-generic-list-folder-important (spec overview) nil) @@ -659,6 +664,9 @@ without cacheing." (defun elmo-commit (folder) (elmo-call-func folder "commit")) +(defun elmo-clear-killed (folder) + (elmo-call-func folder "clear-killed")) + ;; returns cons cell of (unsync . number-of-messages-in-folder) (defun elmo-folder-diff (fld &optional number-alist) (interactive) -- 1.7.10.4