comparison lisp/mail/rmail.el @ 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 d857f7e1113d
children 53cfff0db399
comparison
equal deleted inserted replaced
18988:35c373c1f925 18989:6253a99afd95
99 99
100 (defcustom rmail-pop-password-required nil 100 (defcustom rmail-pop-password-required nil
101 "*Non-nil if a password is required when reading mail using POP." 101 "*Non-nil if a password is required when reading mail using POP."
102 :type 'boolean 102 :type 'boolean
103 :group 'rmail-retrieve) 103 :group 'rmail-retrieve)
104
105 (defvar rmail-pop-password-error "invalid usercode or password"
106 "Regular expression matching incorrect-password POP server error messages.
107 If you get an incorrect-password error that this expression does not match,
108 please report it with \\[report-emacs-bug].")
104 109
105 (defcustom rmail-preserve-inbox nil 110 (defcustom rmail-preserve-inbox nil
106 "*Non-nil if incoming mail should be left in the user's inbox, 111 "*Non-nil if incoming mail should be left in the user's inbox,
107 rather than deleted, after it is retrieved." 112 rather than deleted, after it is retrieved."
108 :type 'boolean 113 :type 'boolean
1181 ;; Detect a locked file now, so that we avoid moving mail 1186 ;; Detect a locked file now, so that we avoid moving mail
1182 ;; out of the real inbox file. (That could scare people.) 1187 ;; out of the real inbox file. (That could scare people.)
1183 (or (memq (file-locked-p buffer-file-name) '(nil t)) 1188 (or (memq (file-locked-p buffer-file-name) '(nil t))
1184 (error "RMAIL file %s is locked" 1189 (error "RMAIL file %s is locked"
1185 (file-name-nondirectory buffer-file-name))) 1190 (file-name-nondirectory buffer-file-name)))
1186 (let (file tofile delete-files movemail popmail) 1191 (let (file tofile delete-files movemail popmail got-password)
1187 (while files 1192 (while files
1188 (setq file (file-truename 1193 (setq file (file-truename
1189 (expand-file-name (substitute-in-file-name (car files)))) 1194 (expand-file-name (substitute-in-file-name (car files))))
1190 tofile (expand-file-name 1195 tofile (expand-file-name
1191 ;; Generate name to move to from inbox name, 1196 ;; Generate name to move to from inbox name,
1220 (cond (popmail 1225 (cond (popmail
1221 (if (and rmail-pop-password-required (not rmail-pop-password)) 1226 (if (and rmail-pop-password-required (not rmail-pop-password))
1222 (setq rmail-pop-password 1227 (setq rmail-pop-password
1223 (rmail-read-passwd 1228 (rmail-read-passwd
1224 (format "Password for %s: " 1229 (format "Password for %s: "
1225 (substring file (+ popmail 3)))))) 1230 (substring file (+ popmail 3))))
1231 got-password t))
1226 (if (eq system-type 'windows-nt) 1232 (if (eq system-type 'windows-nt)
1227 ;; cannot have "po:" in file name 1233 ;; cannot have "po:" in file name
1228 (setq tofile 1234 (setq tofile
1229 (expand-file-name 1235 (expand-file-name
1230 (concat ".newmail-pop-" (substring file (+ popmail 3))) 1236 (concat ".newmail-pop-" (substring file (+ popmail 3)))
1295 (delete-region (point-min) (match-end 0))) 1301 (delete-region (point-min) (match-end 0)))
1296 (beep t) 1302 (beep t)
1297 (message "movemail: %s" 1303 (message "movemail: %s"
1298 (buffer-substring (point-min) 1304 (buffer-substring (point-min)
1299 (point-max))) 1305 (point-max)))
1306
1307 (if (or got-password
1308 ;; If the error was for an incorrect password,
1309 ;; arrange to try again to read the password.
1310 (re-search-forward rmail-pop-password-error
1311 nil t))
1312 (setq rmail-pop-password nil))
1300 (sit-for 3) 1313 (sit-for 3)
1301 nil)) 1314 nil))
1302 (if errors (kill-buffer errors)))))) 1315 (if errors (kill-buffer errors))))))
1303 ;; At this point, TOFILE contains the name to read: 1316 ;; At this point, TOFILE contains the name to read:
1304 ;; Either the alternate name (if we renamed) 1317 ;; Either the alternate name (if we renamed)