Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / nnbabyl.el
index fa5e25a..8cecb1e 100644 (file)
@@ -1,10 +1,10 @@
 ;;; nnbabyl.el --- rmail mbox access for Gnus
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1099, 2000
+;; Copyright (C) 1995, 1996, 1997, 1998, 1099, 2000, 2001
 ;;     Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
-;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
+;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;; Keywords: news, mail
 
 ;; This file is part of GNU Emacs.
@@ -31,6 +31,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (require 'nnheader)
 (condition-case nil
     (require 'rmail)
@@ -38,7 +40,6 @@
       5 "Ignore rmail errors from this file, you don't have rmail")))
 (require 'nnmail)
 (require 'nnoo)
-(eval-when-compile (require 'cl))
 
 (nnoo-declare nnbabyl)
 
@@ -51,6 +52,7 @@
 (defvoo nnbabyl-get-new-mail t
   "If non-nil, nnbabyl will check the incoming mail file and split the mail.")
 
+
 (defvoo nnbabyl-prepare-save-mail-hook nil
   "Hook run narrowed to an article before saving.")
 
                     (buffer-substring
                      (point) (progn (end-of-line) (point))) force))
              (progn
+               (unless (eq nnmail-expiry-target 'delete)
+                 (with-temp-buffer
+                   (nnbabyl-request-article (car articles)
+                                            newsgroup server
+                                            (current-buffer))
+                   (let ((nnml-current-directory nil))
+                     (nnmail-expiry-target-group
+                      nnmail-expiry-target newsgroup)))
+                 (nnbabyl-possibly-change-newsgroup newsgroup server))
                (nnheader-message 5 "Deleting article %d in %s..."
                                  (car articles) newsgroup)
                (nnbabyl-delete-mail))
         (while (re-search-backward "^X-Gnus-Newsgroup: " beg t)
           (delete-region (point) (progn (forward-line 1) (point)))))
        (when nnmail-cache-accepted-message-ids
-        (nnmail-cache-insert (nnmail-fetch-field "message-id")))
+        (nnmail-cache-insert (nnmail-fetch-field "message-id") group))
        (setq result
             (if (stringp group)
                 (list (cons group (nnbabyl-active-number group)))
        (insert-buffer-substring buf)
        (when last
         (when nnmail-cache-accepted-message-ids
-          (nnmail-cache-insert (nnmail-fetch-field "message-id")))
+          (nnmail-cache-insert (nnmail-fetch-field "message-id") group))
         (save-buffer)
         (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file))
        result))))