(mm-codepage-setup): New helper function.
[gnus] / lisp / gnus-cache.el
index 752ff5d..67a6100 100644 (file)
@@ -1,6 +1,7 @@
 ;;; gnus-cache.el --- cache interface for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-;;        Free Software Foundation, Inc.
+
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+;;   2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -19,8 +20,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -123,8 +124,7 @@ it's not cached."
          (overview-file (gnus-cache-file-name
                          (car gnus-cache-buffer) ".overview")))
       ;; write the overview only if it was modified
-      (when (and (buffer-live-p buffer)
-                (buffer-modified-p buffer))
+      (when (and (buffer-live-p buffer) (buffer-modified-p buffer))
        (with-current-buffer buffer
          (if (> (buffer-size) 0)
              ;; Non-empty overview, write it to a file.
@@ -359,7 +359,7 @@ Returns the list of articles removed."
           (let ((alist (gnus-agent-load-alist gnus-newsgroup-name)))
             (unless (cdr (assoc article alist))
               (setq gnus-newsgroup-undownloaded
-                    (gnus-add-to-sorted-list 
+                    (gnus-add-to-sorted-list
                      gnus-newsgroup-undownloaded article)))))
        (push article out))
       (gnus-summary-update-download-mark article)
@@ -423,6 +423,7 @@ Returns the list of articles removed."
       (and (not unread) (not ticked) (not dormant) (memq 'read class))))
 
 (defun gnus-cache-file-name (group article)
+  (setq group (gnus-group-decoded-name group))
   (expand-file-name
    (if (stringp article) article (int-to-string article))
    (file-name-as-directory
@@ -490,7 +491,7 @@ Returns the list of articles removed."
        articles)
     (when (file-exists-p dir)
       (setq articles
-           (sort (mapcar (lambda (name) (string-to-int name))
+           (sort (mapcar (lambda (name) (string-to-number name))
                          (directory-files dir nil "^[0-9]+$" t))
                  '<))
       ;; Update the cache active file, just to synch more.
@@ -682,7 +683,7 @@ If LOW, update the lower bound instead."
     ;; Separate articles from all other files and directories.
     (while files
       (if (string-match "^[0-9]+$" (file-name-nondirectory (car files)))
-         (push (string-to-int (file-name-nondirectory (pop files))) nums)
+         (push (string-to-number (file-name-nondirectory (pop files))) nums)
        (push (pop files) alphs)))
     ;; If we have nums, then this is probably a valid group.
     (when (setq nums (sort nums '<))
@@ -760,7 +761,7 @@ next enabled. Depends upon the caller to determine whether group renaming is sup
 disabled, as the old cache files would corrupt gnus when the cache was
 next enabled. Depends upon the caller to determine whether group deletion is supported."
   (let ((dir (gnus-cache-file-name group "")))
-    (gnus-delete-file dir))
+    (gnus-delete-directory dir))
 
   (gnus-cache-delete-group-total-fetched-for group)