This variable is \"/usr/spool/mail/$user\" by default.
If this variable is nil, no mail backends will read incoming mail.
If this variable is a list, all files mentioned in this list will be
-used as incoming mailboxes.")
+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.")
(defvar nnmail-crash-box "~/.gnus-crash-box"
"*File where Gnus will store mail while processing it.")
(defun nnmail-date-to-time (date)
"Convert DATE into time."
- (let* ((d1 (timezone-parse-date date))
- (t1 (timezone-parse-time (aref d1 3))))
- (apply 'encode-time
- (mapcar (lambda (el)
- (and el (string-to-number el)))
- (list
- (aref t1 2) (aref t1 1) (aref t1 0)
- (aref d1 2) (aref d1 1) (aref d1 0)
- (aref d1 4))))))
+ (condition-case ()
+ (let* ((d1 (timezone-parse-date date))
+ (t1 (timezone-parse-time (aref d1 3))))
+ (apply 'encode-time
+ (mapcar (lambda (el)
+ (and el (string-to-number el)))
+ (list
+ (aref t1 2) (aref t1 1) (aref t1 0)
+ (aref d1 2) (aref d1 1) (aref d1 0)
+ (aref d1 4)))))
+ ;; If we get an error, then we just return a 0 time.
+ (error (list 0 0))))
(defun nnmail-time-less (t1 t2)
"Say whether time T1 is less than time T2."
(goto-char end))))
(defun nnmail-search-unix-mail-delim ()
- "Put point at the beginning of the next message."
- (let ((case-fold-search t)
- (delim (concat "^" message-unix-mail-delimiter))
+ "Put point at the beginning of the next Unix mbox message."
+ ;; Algorithm used to find the the next article in the
+ ;; brain-dead Unix mbox format:
+ ;;
+ ;; 1) Search for "^From ".
+ ;; 2) If we find it, then see whether the previous
+ ;; line is blank and the next line looks like a header.
+ ;; Then it's possible that this is a mail delim, and we use it.
+ (let ((case-fold-search nil)
found)
(while (not found)
- (if (re-search-forward delim nil t)
- (when (or (looking-at "[^\n :]+ *:")
- (looking-at delim)
- (looking-at (concat ">" message-unix-mail-delimiter)))
- (forward-line -1)
- (setq found 'yes))
- (setq found 'no)))
+ (if (not (re-search-forward "^From " nil t))
+ (setq found 'no)
+ (beginning-of-line)
+ (when (and (or (bobp)
+ (save-excursion
+ (forward-line -1)
+ (= (following-char) ?\n)))
+ (save-excursion
+ (forward-line 1)
+ (looking-at "[^ \t:]+[ \t]*:")))
+ (setq found 'yes))))
(eq found 'yes)))
(defun nnmail-process-unix-mail-format (func artnum-func)
- (let ((case-fold-search t)
- (delim (concat "^" message-unix-mail-delimiter))
+ (let ((case-fold-search nil)
start message-id content-length end skip head-end)
(goto-char (point-min))
- (if (not (and (re-search-forward delim nil t)
+ (if (not (and (re-search-forward "^From " nil t)
(goto-char (match-beginning 0))))
;; Possibly wrong format?
(error "Error, unknown mail format! (Possibly corrupted.)")
(cond ((or (= skip (point-max))
(= (1+ skip) (point-max)))
(setq end (point-max)))
- ((looking-at delim)
+ ((looking-at "From ")
(setq end skip))
- ((looking-at
- (concat "[ \t]*\n\\(" delim "\\)"))
+ ((looking-at "[ \t]*\n\\(From \\)")
(setq end (match-beginning 1)))
(t (setq end nil))))
(if end
(eq nnmail-spool-file 'procmail))
nil)
((listp nnmail-spool-file)
- (append nnmail-spool-file procmails))
- ((stringp nnmail-spool-file)
+ (nconc
+ (apply
+ 'nconc
+ (mapcar
+ (lambda (file)
+ (if (file-directory-p file)
+ (nnheader-directory-regular-files file)
+ (list file)))
+ nnmail-spool-file))
+ procmails))
+ ((and (stringp nnmail-spool-file)
+ (not (file-directory-p nnmail-spool-file)))
(cons nnmail-spool-file procmails))
+ ((and (stringp nnmail-spool-file)
+ (file-directory-p nnmail-spool-file))
+ (nconc
+ (nnheader-directory-regular-files nnmail-spool-file)
+ procmails))
((eq nnmail-spool-file 'pop)
(cons (format "po:%s" (user-login-name)) procmails))
(t
(nnmail-time-less days (nnmail-time-since time)))))))
(defvar nnmail-read-passwd nil)
-(defun nnmail-read-passwd (prompt)
- (unless nnmail-read-passwd
- (if (load "passwd" t)
- (setq nnmail-read-passwd 'read-passwd)
- (autoload 'ange-ftp-read-passwd "ange-ftp")
- (setq nnmail-read-passwd 'ange-ftp-read-passwd)))
- (funcall nnmail-read-passwd prompt))
+(defun nnmail-read-passwd (prompt &rest args)
+ "Read a password using PROMPT.
+If ARGS, PROMPT is used as an argument to `format'."
+ (let ((prompt
+ (if args
+ (apply 'format prompt args)
+ prompt)))
+ (unless nnmail-read-passwd
+ (if (load "passwd" t)
+ (setq nnmail-read-passwd '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 ()
"Check (and modify) the syntax of the message in the current buffer."