From 0974f7bfcf39e1ffa5b73339121357824bfd5050 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Jul 1997 22:08:24 +0000 Subject: [PATCH] (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. --- lisp/mail/rmail.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index ae454335d3f..15680690d5d 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -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 @@ It returns t if it got any new messages." (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 @@ It returns t if it got any new messages." (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 @@ It returns t if it got any new messages." (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)))))) -- 2.39.5