changeset 18989:6253a99afd95

(rmail-pop-password-error): New variable. (rmail-insert-inbox-text): If there's an error getting mail from the POP server, and the error matches rmail-pop-password-error or we prompted for the POP password, assume that the password is incorrect and erase it so that the user will be prompted again the next time he gets mail.
author Richard M. Stallman <rms@gnu.org>
date Fri, 25 Jul 1997 22:08:24 +0000
parents 35c373c1f925
children 53cfff0db399
files lisp/mail/rmail.el
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Fri Jul 25 20:51:42 1997 +0000
+++ b/lisp/mail/rmail.el	Fri Jul 25 22:08:24 1997 +0000
@@ -102,6 +102,11 @@
   :type 'boolean
   :group 'rmail-retrieve)
 
+(defvar rmail-pop-password-error "invalid usercode or password"
+  "Regular expression matching incorrect-password POP server error messages.
+If you get an incorrect-password error that this expression does not match,
+please report it with \\[report-emacs-bug].")
+
 (defcustom rmail-preserve-inbox nil
   "*Non-nil if incoming mail should be left in the user's inbox,
 rather than deleted, after it is retrieved."
@@ -1183,7 +1188,7 @@
   (or (memq (file-locked-p buffer-file-name) '(nil t))
       (error "RMAIL file %s is locked"
 	     (file-name-nondirectory buffer-file-name)))
-  (let (file tofile delete-files movemail popmail)
+  (let (file tofile delete-files movemail popmail got-password)
     (while files
       (setq file (file-truename
 		  (expand-file-name (substitute-in-file-name (car files))))
@@ -1222,7 +1227,8 @@
 		 (setq rmail-pop-password
 		       (rmail-read-passwd
 			(format "Password for %s: "
-				(substring file (+ popmail 3))))))
+				(substring file (+ popmail 3))))
+		       got-password t))
 	     (if (eq system-type 'windows-nt)
 		 ;; cannot have "po:" in file name
 		 (setq tofile
@@ -1297,6 +1303,13 @@
 		       (message "movemail: %s"
 				(buffer-substring (point-min)
 						  (point-max)))
+
+		       (if (or got-password
+			       ;; If the error was  for an incorrect password,
+			       ;; arrange to try again to read the password.
+			       (re-search-forward rmail-pop-password-error
+						  nil t))
+			   (setq rmail-pop-password nil))
 		       (sit-for 3)
 		       nil))
 		 (if errors (kill-buffer errors))))))