*** empty log message ***
[gnus] / lisp / nnkiboze.el
index 681b006..7b669ae 100644 (file)
@@ -1,5 +1,5 @@
 ;;; nnkiboze.el --- select virtual news access for Gnus
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
 ;; Keywords: news
@@ -17,8 +17,9 @@
 ;; GNU General Public License for more details.
 
 ;; 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; 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.
 
 ;;; Commentary:
 
@@ -32,6 +33,7 @@
 (require 'nnheader)
 (require 'gnus)
 (require 'gnus-score)
+(eval-when-compile (require 'cl))
 
 (defvar nnkiboze-directory 
   (expand-file-name (or gnus-article-save-directory "~/News/"))
@@ -107,7 +109,7 @@ If the stream is opened, return T, otherwise return NIL."
   "Select article by message number."
   (nnkiboze-possibly-change-newsgroups newsgroup)
   (if (not (numberp article))
-      ;; This is a real cludge. It might not work at times, but it
+      ;; This is a real kludge. It might not work at times, but it
       ;; does no harm I think. The only alternative is to offer no
       ;; article fetching by message-id at all.
       (nntp-request-article article newsgroup gnus-nntp-server buffer)
@@ -151,9 +153,9 @@ If the stream is opened, return T, otherwise return NIL."
 (defun nnkiboze-close-group (group &optional server)
   (nnkiboze-possibly-change-newsgroups group)
   ;; Remove NOV lines of articles that are marked as read.
-  (if (or (not (file-exists-p (nnkiboze-nov-file-name)))
-         (not nnkiboze-remove-read-articles))
-      ()
+  (when (and (file-exists-p (nnkiboze-nov-file-name))
+            nnkiboze-remove-read-articles
+            (eq major-mode 'gnus-summary-mode))
     (save-excursion
       (let ((unreads gnus-newsgroup-unreads)
            (unselected gnus-newsgroup-unselected)
@@ -176,19 +178,27 @@ If the stream is opened, return T, otherwise return NIL."
     (setq nnkiboze-current-group nil)))
 
 (defun nnkiboze-request-list (&optional server) 
-  (setq nnkiboze-status-string "nnkiboze: LIST is not implemented.")
-  nil)
+  (nnheader-report 'nnkiboze "LIST is not implemented."))
 
 (defun nnkiboze-request-newgroups (date &optional server)
   "List new groups."
-  (setq nnkiboze-status-string "NEWGROUPS is not supported.")
-  nil)
+  (nnheader-report 'nnkiboze "NEWGROUPS is not supported."))
 
 (defun nnkiboze-request-list-newsgroups (&optional server)
-  (setq nnkiboze-status-string "nnkiboze: LIST NEWSGROUPS is not implemented.")
-  nil)
+  (nnheader-report 'nnkiboze "LIST NEWSGROUPS is not implemented."))
 
-(defalias 'nnkiboze-request-post 'nntp-request-post)
+(defun nnkiboze-request-delete-group (group &optional force server)
+  (nnkiboze-possibly-change-newsgroups group)
+  (when force
+     (let ((files (list (nnkiboze-nov-file-name)
+                       (concat nnkiboze-directory group ".newsrc")
+                       (nnkiboze-score-file group))))
+       (while files
+        (and (file-exists-p (car files))
+             (file-writable-p (car files))
+             (delete-file (car files)))
+        (setq files (cdr files)))))
+  (setq nnkiboze-current-group nil))
 
 \f
 ;;; Internal functions.
@@ -224,8 +234,10 @@ Finds out what articles are to be part of the nnkiboze groups."
 
 (defun nnkiboze-score-file (group)
   (list (expand-file-name
-        (concat gnus-kill-files-directory nnkiboze-current-score-group 
-                "." gnus-score-file-suffix))))
+        (concat (file-name-as-directory gnus-kill-files-directory)
+                (nnheader-translate-file-chars
+                 (concat nnkiboze-current-score-group 
+                         "." gnus-score-file-suffix))))))
 
 (defun nnkiboze-generate-group (group) 
   (let* ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
@@ -378,8 +390,9 @@ Finds out what articles are to be part of the nnkiboze groups."
            (insert prefix)))))))
 
 (defun nnkiboze-nov-file-name ()
-  (concat nnkiboze-directory
-         (nnkiboze-prefixed-name nnkiboze-current-group) ".nov"))
+  (concat (file-name-as-directory nnkiboze-directory)
+         (nnheader-translate-file-chars
+          (concat (nnkiboze-prefixed-name nnkiboze-current-group) ".nov"))))
 
 (provide 'nnkiboze)