From 1d7e326dd763c8c031244eaa9ab2132cd6719992 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 11 Apr 2003 01:55:02 +0000 Subject: [PATCH] Synch to Oort Gnus 200304110151. --- lisp/ChangeLog | 11 +++++++++ lisp/gnus-agent.el | 63 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 164fd1c..a9db169 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2003-04-10 Kevin Greiner + + * gnus-agent.el (gnus-agent-get-undownloaded-list): Articles in + the CACHE are now detected and handled the same as an article + downloaded into the agent. + (gnus-agent-group-path): Modified to match nnmail-group-pathname + so that the agent front-end and back-end (nnagent) always use the + same directory. + (gnus-agent-group-pathname): New function. Wrapper for + nnmail-group-pathname. + 2003-04-10 Jesper Harder * gnus-sum.el (gnus-summary-make-menu-bar): Disable "Encrypt diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index b064c70..4912bcb 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -30,6 +30,7 @@ (require 'gnus) (require 'gnus-cache) +(require 'nnmail) (require 'nnvirtual) (require 'gnus-sum) (require 'gnus-score) @@ -911,6 +912,7 @@ article's mark is toggled." (headers (sort (mapcar (lambda (h) (mail-header-number h)) gnus-newsgroup-headers) '<)) + (cached (and gnus-use-cache gnus-newsgroup-cached)) (undownloaded (list nil)) (tail-undownloaded undownloaded) (unfetched (list nil)) @@ -937,7 +939,14 @@ article's mark is toggled." (t (pop alist) (pop headers) - (gnus-agent-append-to-list tail-undownloaded a))))) + + ;; This article isn't in the agent. Check to see + ;; if it is in the cache. If it is, it's been + ;; downloaded. + (while (and cached (< (car cached) a)) + (pop cached)) + (unless (equal a (car cached)) + (gnus-agent-append-to-list tail-undownloaded a)))))) (while headers (let ((num (pop headers))) @@ -1135,16 +1144,31 @@ This can be added to `gnus-select-article-hook' or (defun gnus-agent-group-path (group) "Translate GROUP into a file name." - (if nnmail-use-long-file-names - (gnus-group-real-name group) - (nnheader-translate-file-chars - (nnheader-replace-chars-in-string - (nnheader-replace-duplicate-chars-in-string - (nnheader-replace-chars-in-string - (gnus-group-real-name group) - ?/ ?_) - ?. ?_) - ?. ?/)))) + + ;; NOTE: This is what nnmail-group-pathname does as of Apr 2003. + ;; The two methods must be kept synchronized, which is why + ;; gnus-agent-group-pathname was added. + + (setq group + (nnheader-translate-file-chars + (nnheader-replace-duplicate-chars-in-string + (nnheader-replace-chars-in-string + (gnus-group-real-name group) + ?/ ?_) + ?. ?_))) + (if (or nnmail-use-long-file-names + (file-directory-p (expand-file-name group (gnus-agent-directory)))) + group + (mm-encode-coding-string + (nnheader-replace-chars-in-string group ?. ?/) + nnmail-pathname-coding-system))) + +(defun gnus-agent-group-pathname (group) + "Translate GROUP into a file name." + ;; nnagent uses nnmail-group-pathname to read articles while + ;; unplugged. The agent must, therefore, use the same directory + ;; while plugged. + (nnmail-group-pathname (gnus-group-real-name group) (gnus-agent-directory))) (defun gnus-agent-get-function (method) (if (gnus-online method) @@ -1241,9 +1265,7 @@ This can be added to `gnus-select-article-hook' or (when (or (cdr selected-sets) (car selected-sets)) (let* ((fetched-articles (list nil)) (tail-fetched-articles fetched-articles) - (dir (concat - (gnus-agent-directory) - (gnus-agent-group-path group) "/")) + (dir (gnus-agent-group-pathname group)) (date (time-to-days (current-time))) (case-fold-search t) pos crosses id) @@ -1744,8 +1766,7 @@ FILE and places the combined headers into `nntp-server-buffer'." (defun gnus-agent-article-name (article group) (expand-file-name article (file-name-as-directory - (expand-file-name (gnus-agent-group-path group) - (gnus-agent-directory))))) + (gnus-agent-group-pathname group)))) (defun gnus-agent-batch-confirmation (msg) "Show error message and return t." @@ -2472,10 +2493,7 @@ FORCE is equivalent to setting the expiration predicates to true." ;; gnus-command-method, initialized overview buffer, and to have ;; provided a non-nil active - (let ((dir (concat - (gnus-agent-directory) - (gnus-agent-group-path group) - "/"))) + (let ((dir (gnus-agent-group-pathname group))) (when (boundp 'gnus-agent-expire-current-dirs) (set 'gnus-agent-expire-current-dirs (cons dir @@ -3123,10 +3141,7 @@ has been fetched." (not gnus-plugged)) (numberp article)) (let* ((gnus-command-method (gnus-find-method-for-group group)) - (file (concat - (gnus-agent-directory) - (gnus-agent-group-path group) "/" - (number-to-string article))) + (file (gnus-agent-article-name (number-to-string article) group)) (buffer-read-only nil)) (when (and (file-exists-p file) (> (nth 7 (file-attributes file)) 0)) -- 1.7.10.4