comparison lisp/gnus/nnmail.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
236 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\")) 236 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\"))
237 ;; Unmatched mail goes to the catch all group. 237 ;; Unmatched mail goes to the catch all group.
238 \"misc.misc\"))") 238 \"misc.misc\"))")
239 239
240 (defvar nnmail-split-abbrev-alist 240 (defvar nnmail-split-abbrev-alist
241 '((any . "from\\|to\\|cc\\|sender\\|apparently-to") 241 '((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc")
242 (mail . "mailer-daemon\\|postmaster")) 242 (mail . "mailer-daemon\\|postmaster"))
243 "*Alist of abbreviations allowed in `nnmail-split-fancy'.") 243 "*Alist of abbreviations allowed in `nnmail-split-fancy'.")
244 244
245 (defvar nnmail-delete-incoming t 245 (defvar nnmail-delete-incoming t
246 "*If non-nil, the mail backends will delete incoming files after splitting.") 246 "*If non-nil, the mail backends will delete incoming files after splitting.")
267 ;;; Internal variables. 267 ;;; Internal variables.
268 268
269 (defvar nnmail-pop-password nil 269 (defvar nnmail-pop-password nil
270 "*Password to use when reading mail from a POP server, if required.") 270 "*Password to use when reading mail from a POP server, if required.")
271 271
272 (defvar nnmail-split-fancy-syntax-table 272 (defvar nnmail-split-fancy-syntax-table nil
273 (copy-syntax-table (standard-syntax-table))
274 "Syntax table used by `nnmail-split-fancy'.") 273 "Syntax table used by `nnmail-split-fancy'.")
274 (unless (syntax-table-p nnmail-split-fancy-syntax-table)
275 (setq nnmail-split-fancy-syntax-table
276 (copy-syntax-table (standard-syntax-table)))
277 ;; support the %-hack
278 (modify-syntax-entry ?\% "." nnmail-split-fancy-syntax-table))
279
275 280
276 (defvar nnmail-prepare-save-mail-hook nil 281 (defvar nnmail-prepare-save-mail-hook nil
277 "Hook called before saving mail.") 282 "Hook called before saving mail.")
278 283
279 (defvar nnmail-moved-inboxes nil 284 (defvar nnmail-moved-inboxes nil
351 (- (+ (or rest 0) (nth 1 current)) (nth 1 time))))) 356 (- (+ (or rest 0) (nth 1 current)) (nth 1 time)))))
352 357
353 ;; Function rewritten from rmail.el. 358 ;; Function rewritten from rmail.el.
354 (defun nnmail-move-inbox (inbox) 359 (defun nnmail-move-inbox (inbox)
355 "Move INBOX to `nnmail-crash-box'." 360 "Move INBOX to `nnmail-crash-box'."
356 (let ((inbox (file-truename 361 (let ((inbox (file-truename (expand-file-name inbox)))
357 (expand-file-name (substitute-in-file-name inbox)))) 362 (tofile (file-truename (expand-file-name nnmail-crash-box)))
358 (tofile (file-truename (expand-file-name
359 (substitute-in-file-name nnmail-crash-box))))
360 movemail popmail errors password) 363 movemail popmail errors password)
361 ;; If getting from mail spool directory, 364 ;; If getting from mail spool directory,
362 ;; use movemail to move rather than just renaming, 365 ;; use movemail to move rather than just renaming,
363 ;; so as to interlock with the mailer. 366 ;; so as to interlock with the mailer.
364 (unless (setq popmail (string-match "^po:" (file-name-nondirectory inbox))) 367 (unless (setq popmail (string-match "^po:" (file-name-nondirectory inbox)))
380 (nnmail-read-passwd 383 (nnmail-read-passwd
381 (format "Password for %s: " 384 (format "Password for %s: "
382 (substring inbox (+ popmail 3)))))) 385 (substring inbox (+ popmail 3))))))
383 (message "Getting mail from post office ...")) 386 (message "Getting mail from post office ..."))
384 (when (or (and (file-exists-p tofile) 387 (when (or (and (file-exists-p tofile)
385 (/= 0 (nth 7 (file-attributes tofile)))) 388 (/= 0 (nnheader-file-size tofile)))
386 (and (file-exists-p inbox) 389 (and (file-exists-p inbox)
387 (/= 0 (nth 7 (file-attributes inbox))))) 390 (/= 0 (nnheader-file-size inbox))))
388 (message "Getting mail from %s..." inbox))) 391 (message "Getting mail from %s..." inbox)))
389 ;; Set TOFILE if have not already done so, and 392 ;; Set TOFILE if have not already done so, and
390 ;; rename or copy the file INBOX to TOFILE if and as appropriate. 393 ;; rename or copy the file INBOX to TOFILE if and as appropriate.
391 (cond 394 (cond
392 ((file-exists-p tofile) 395 ((file-exists-p tofile)
435 (skip-chars-backward " \t") 438 (skip-chars-backward " \t")
436 (delete-region (point) (point-max)) 439 (delete-region (point) (point-max))
437 (goto-char (point-min)) 440 (goto-char (point-min))
438 (if (looking-at "movemail: ") 441 (if (looking-at "movemail: ")
439 (delete-region (point-min) (match-end 0))) 442 (delete-region (point-min) (match-end 0)))
440 (beep t) 443 (error (concat "movemail: " (buffer-string)))
441 (message (concat "movemail: "
442 (buffer-substring (point-min)
443 (point-max))))
444 (sit-for 3)
445 (setq tofile nil)))))) 444 (setq tofile nil))))))
446 (and errors 445 (and errors
447 (buffer-name errors) 446 (buffer-name errors)
448 (kill-buffer errors)) 447 (kill-buffer errors))
449 tofile))) 448 tofile)))
921 nnmail-procmail-directory 920 nnmail-procmail-directory
922 t (concat (if group (concat "^" group) "") 921 t (concat (if group (concat "^" group) "")
923 nnmail-procmail-suffix "$") t))) 922 nnmail-procmail-suffix "$") t)))
924 (p procmails) 923 (p procmails)
925 (crash (when (and (file-exists-p nnmail-crash-box) 924 (crash (when (and (file-exists-p nnmail-crash-box)
926 (> (nth 7 (file-attributes 925 (> (nnheader-file-size
927 (file-truename nnmail-crash-box))) 0)) 926 (file-truename nnmail-crash-box)) 0))
928 (list nnmail-crash-box)))) 927 (list nnmail-crash-box))))
929 ;; Remove any directories that inadvertantly match the procmail 928 ;; Remove any directories that inadvertantly match the procmail
930 ;; suffix, which might happen if the suffix is "". 929 ;; suffix, which might happen if the suffix is "".
931 (while p 930 (while p
932 (when (file-directory-p (car p)) 931 (when (file-directory-p (car p))
935 ;; Return the list of spools. 934 ;; Return the list of spools.
936 (append 935 (append
937 crash 936 crash
938 (cond ((and group 937 (cond ((and group
939 (or (eq nnmail-spool-file 'procmail) 938 (or (eq nnmail-spool-file 'procmail)
940 nnmail-use-procmail)) 939 nnmail-use-procmail)
940 procmails)
941 procmails) 941 procmails)
942 ((and group
943 (eq nnmail-spool-file 'procmail))
944 nil)
942 ((listp nnmail-spool-file) 945 ((listp nnmail-spool-file)
943 (append nnmail-spool-file procmails)) 946 (append nnmail-spool-file procmails))
944 ((stringp nnmail-spool-file) 947 ((stringp nnmail-spool-file)
945 (cons nnmail-spool-file procmails)) 948 (cons nnmail-spool-file procmails))
946 ((eq nnmail-spool-file 'pop) 949 ((eq nnmail-spool-file 'pop)
1105 ;; We read each spool file if either the spool is a POP-mail 1108 ;; We read each spool file if either the spool is a POP-mail
1106 ;; spool, or the file exists. We can't check for the 1109 ;; spool, or the file exists. We can't check for the
1107 ;; existance of POPped mail. 1110 ;; existance of POPped mail.
1108 (when (or (string-match "^po:" spool) 1111 (when (or (string-match "^po:" spool)
1109 (and (file-exists-p spool) 1112 (and (file-exists-p spool)
1110 (> (nth 7 (file-attributes (file-truename spool))) 0))) 1113 (> (nnheader-file-size (file-truename spool)) 0)))
1111 (nnheader-message 3 "%s: Reading incoming mail..." method) 1114 (nnheader-message 3 "%s: Reading incoming mail..." method)
1112 (when (and (nnmail-move-inbox spool) 1115 (when (and (nnmail-move-inbox spool)
1113 (file-exists-p nnmail-crash-box)) 1116 (file-exists-p nnmail-crash-box))
1114 ;; There is new mail. We first find out if all this mail 1117 ;; There is new mail. We first find out if all this mail
1115 ;; is supposed to go to some specific group. 1118 ;; is supposed to go to some specific group.