*** empty log message ***
[gnus] / lisp / nnmbox.el
index 6c8dd28..13fc297 100644 (file)
@@ -1,7 +1,7 @@
 ;;; nnmbox.el --- mail mbox access for Gnus
-;; Copyright (C) 1995,96,97 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98 Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;; Keywords: news, mail
 
 ;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; 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, Inc., 59 Temple Place - Suite 330,
            (nnmbox-article-group-number)))))))
 
 (deffoo nnmbox-request-group (group &optional server dont-check)
+  (nnmbox-possibly-change-newsgroup nil server)
   (let ((active (cadr (assoc group nnmbox-group-alist))))
     (cond
      ((or (null active)
 (deffoo nnmbox-close-group (group &optional server)
   t)
 
+(deffoo nnmbox-request-create-group (group &optional server args)
+  (nnmail-activate 'nnmbox)
+  (unless (assoc group nnmbox-group-alist)
+    (push (list group (cons 1 0))
+         nnmbox-group-alist)
+    (nnmail-save-active nnmbox-group-alist nnmbox-active-file))
+  t)
+
 (deffoo nnmbox-request-list (&optional server)
   (save-excursion
     (nnmail-find-file nnmbox-active-file)
      (nnmbox-request-article article group server)
      (save-excursion
        (set-buffer buf)
-       (buffer-disable-undo (current-buffer))
        (erase-buffer)
        (insert-buffer-substring nntp-server-buffer)
        (goto-char (point-min))
        (forward-line -1)
        (while (re-search-backward "^X-Gnus-Newsgroup: " nil t)
         (delete-region (point) (progn (forward-line 1) (point))))
-       (nnmail-cache-insert (nnmail-fetch-field "message-id"))
-       (setq result (nnmbox-save-mail
-                    (if (stringp group)
-                        (list (cons group (nnmbox-active-number group)))
-                      (nnmail-article-group 'nnmbox-active-number)))))
+       (when nnmail-cache-accepted-message-ids
+        (nnmail-cache-insert (nnmail-fetch-field "message-id")))
+       (setq result (if (stringp group)
+                       (list (cons group (nnmbox-active-number group)))
+                     (nnmail-article-group 'nnmbox-active-number)))
+       (if (and (null result)
+               (yes-or-no-p "Moved to `junk' group; delete article? "))
+          (setq result 'junk)
+        (setq result (car (nnmbox-save-mail result)))))
      (save-excursion
        (set-buffer nnmbox-mbox-buffer)
        (goto-char (point-max))
        (insert-buffer-substring buf)
        (when last
-        (nnmail-cache-close)
+        (when nnmail-cache-accepted-message-ids
+          (nnmail-cache-close))
         (nnmail-save-active nnmbox-group-alist nnmbox-active-file)
         (save-buffer))))
-    (car result)))
+    result))
 
 (deffoo nnmbox-request-replace-article (article group buffer)
   (nnmbox-possibly-change-newsgroup group)
     (save-excursion
       (set-buffer (setq nnmbox-mbox-buffer
                        (nnheader-find-file-noselect
-                        nnmbox-mbox-file nil 'raw)))
-      (buffer-disable-undo (current-buffer))))
+                        nnmbox-mbox-file nil t)))
+      (mm-enable-multibyte)
+      (buffer-disable-undo)))
   (when (not nnmbox-group-alist)
     (nnmail-activate 'nnmbox))
   (if newsgroup
            start end number)
        (set-buffer (setq nnmbox-mbox-buffer
                          (nnheader-find-file-noselect
-                          nnmbox-mbox-file nil 'raw)))
-       (buffer-disable-undo (current-buffer))
+                          nnmbox-mbox-file nil t)))
+       (mm-enable-multibyte)
+       (buffer-disable-undo)
 
        ;; Go through the group alist and compare against
        ;; the mbox file.