Function: imap-interactive-login
imap-interactive-login is a byte-compiled function defined in
imap.el.gz.
Signature
(imap-interactive-login BUFFER LOGINFUNC)
Documentation
Login to server in BUFFER.
Return t if login was successful, nil otherwise.
LOGINFUNC is passed a username and a password. It should return t if it successfully authenticates, nil otherwise.
Source Code
;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
;;;; Authenticator functions
(defun imap-interactive-login (buffer loginfunc)
"Login to server in BUFFER.
Return t if login was successful, nil otherwise.
LOGINFUNC is passed a username and a password. It should return
t if it successfully authenticates, nil otherwise."
(with-current-buffer buffer
(make-local-variable 'imap-username)
(make-local-variable 'imap-password)
(let (user passwd ret)
;; (condition-case ()
(while (or (not user) (not passwd))
(setq user (or imap-username
(read-from-minibuffer
(format-message
"imap: username for %s (using stream `%s'): "
imap-server imap-stream)
(or user imap-default-user))))
(setq passwd
(or imap-password
(read-passwd
(format-message
"imap: password for %s@%s (using authenticator `%s'): "
user imap-server imap-auth))))
(when (and user passwd)
(if (funcall loginfunc user passwd)
(progn
(message "imap: Login successful...")
(setq ret t
imap-username user)
(when (and (not imap-password)
(or imap-store-password
(y-or-n-p "imap: Store password for this IMAP session? ")))
(setq imap-password passwd)))
(message "imap: Login failed...")
(setq passwd nil)
(setq imap-password nil)
(sit-for 1))))
;; (quit (with-current-buffer buffer
;; (setq user nil
;; passwd nil)))
;; (error (with-current-buffer buffer
;; (setq user nil
;; passwd nil))))
ret)))