This commit was generated by cvs2svn to compensate for changes in r3968,
[elisp/gnus.git-] / lisp / nnmail.el
index e70b065..8e8359e 100644 (file)
@@ -31,6 +31,7 @@
 (require 'timezone)
 (require 'message)
 (require 'custom)
+(require 'gnus-util)
 
 (eval-and-compile
   (autoload 'gnus-error "gnus-util")
@@ -181,7 +182,8 @@ used as incoming mailboxes.
 If this variable is a directory (i. e., it's name ends with a \"/\"),
 treat all files in that directory as incoming spool files."
   :group 'nnmail-files
-  :type 'file)
+  :type '(choice (file :tag "File")
+                (repeat :tag "Files" file)))
 
 (defcustom nnmail-crash-box "~/.gnus-crash-box"
   "File where Gnus will store mail while processing it."
@@ -491,9 +493,9 @@ parameter.  It should return nil, `warn' or `delete'."
   (let ((format-alist nil)
         (after-insert-file-functions nil))
     (condition-case ()
-       (let ((coding-system-for-read nnmail-file-coding-system)
-             (pathname-coding-system 'binary))
-         (insert-file-contents file)
+       (let ((pathname-coding-system 'binary))
+         (insert-file-contents-as-coding-system
+          nnmail-file-coding-system file)
          t)
       (file-error nil))))
 
@@ -530,7 +532,8 @@ parameter.  It should return nil, `warn' or `delete'."
                        (aref t1 2) (aref t1 1) (aref t1 0)
                        (aref d1 2) (aref d1 1) (aref d1 0)
                        (number-to-string
-                        (* 60 (timezone-zone-to-minute (aref d1 4))))))))
+                        (* 60 (timezone-zone-to-minute
+                                (or (aref d1 4) (current-time-zone)))))))))
     ;; If we get an error, then we just return a 0 time.
     (error (list 0 0))))
 
@@ -658,6 +661,9 @@ parameter.  It should return nil, `warn' or `delete'."
                            (set-file-modes
                             tofile nnmail-default-file-modes))))
                    ;; Probably a real error.
+                   ;; We nix out the password in case the error
+                   ;; was because of a wrong password being given.
+                   (setq nnmail-internal-password nil)
                    (subst-char-in-region (point-min) (point-max) ?\n ?\  )
                    (goto-char (point-max))
                    (skip-chars-backward " \t")
@@ -693,8 +699,7 @@ nn*-request-list should have been called before calling this function."
              group-assoc)))
     group-assoc))
 
-(defvar nnmail-active-file-coding-system
-  'iso-8859-1
+(defvar nnmail-active-file-coding-system 'binary
   "*Coding system for active file.")
 
 (defun nnmail-save-active (group-assoc file-name)
@@ -1135,8 +1140,7 @@ FUNC will be called with the group name to determine the article number."
                       ;; group twice.
                       (not (assoc (car method) group-art)))
                  (push (cons (if regrepp
-                                 (replace-match
-                                  (car method) nil nil (car method))
+                                 (nnmail-expand-newtext (car method))
                                (car method))
                              (funcall func (car method)))
                        group-art))
@@ -1151,7 +1155,7 @@ FUNC will be called with the group name to determine the article number."
          (let ((trace (nreverse nnmail-split-trace))
                (restore (current-buffer)))
            (nnheader-set-temp-buffer "*Split Trace*")
-           (gnus-add-current-to-buffer-list)
+           (gnus-add-buffer)
            (while trace
              (insert (car trace) "\n")
              (setq trace (cdr trace)))
@@ -1348,14 +1352,14 @@ See the documentation for the variable `nnmail-split-fancy' for documentation."
       (unless (= beg pos)
        (push (substring newtext beg pos) expanded))
       (when (< pos len)
-       ;; we hit a \, expand it.
-       (setq did-expand t)
-       (setq pos (1+ pos))
-       (setq c (aref newtext pos))
+       ;; We hit a \; expand it.
+       (setq did-expand t
+             pos (1+ pos)
+             c (aref newtext pos))
        (if (not (or (= c ?\&)
                     (and (>= c ?1)
                          (<= c ?9))))
-           ;; \ followed by some character we don't expand
+           ;; \ followed by some character we don't expand.
            (push (char-to-string c) expanded)
          ;; \& or \N
          (if (= c ?\&)
@@ -1680,11 +1684,13 @@ If ARGS, PROMPT is used as an argument to `format'."
             (apply 'format prompt args)
           prompt)))
     (unless nnmail-read-passwd
-      (if (load "passwd" t)
+      (if (functionp 'read-passwd)
          (setq nnmail-read-passwd 'read-passwd)
-       (unless (fboundp 'ange-ftp-read-passwd)
-         (autoload 'ange-ftp-read-passwd "ange-ftp"))
-       (setq nnmail-read-passwd 'ange-ftp-read-passwd)))
+       (if (load "passwd" t)
+           (setq nnmail-read-passwd 'read-passwd)
+         (unless (fboundp 'ange-ftp-read-passwd)
+           (autoload 'ange-ftp-read-passwd "ange-ftp"))
+         (setq nnmail-read-passwd 'ange-ftp-read-passwd))))
     (funcall nnmail-read-passwd prompt)))
 
 (defun nnmail-check-syntax ()
@@ -1697,9 +1703,9 @@ If ARGS, PROMPT is used as an argument to `format'."
 
 (defun nnmail-write-region (start end filename &optional append visit lockname)
   "Do a `write-region', and then set the file modes."
-  (let ((coding-system-for-write nnmail-file-coding-system)
-       (pathname-coding-system 'binary))
-    (write-region start end filename append visit lockname)
+  (let ((pathname-coding-system 'binary))
+    (write-region-as-coding-system
+     nnmail-file-coding-system start end filename append visit lockname)
     (set-file-modes filename nnmail-default-file-modes)))
 
 ;;;