=== modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2010-10-10 22:48:40 +0000 +++ lisp/gnus/auth-source.el 2010-10-25 02:30:05 +0000 @@ -325,7 +325,9 @@ (cond ((equal "password" m) (let ((passwd (read-passwd - (format "Password for %s on %s: " prot host)))) + (if user + (format "Password for %s on %s/%s: " user host prot) + (format "Password for %s on %s: " prot host))))) (cond ;; Secret Service API. ((consp source) === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2010-10-24 22:32:38 +0000 +++ lisp/gnus/nnimap.el 2010-10-25 01:57:59 +0000 @@ -58,6 +58,9 @@ If nnimap-stream is `ssl', this will default to `imaps'. If not, it will default to `imap'.") +(defvoo nnimap-username nil + "The IMAP username used to login.") + (defvoo nnimap-stream 'ssl "How nnimap will talk to the IMAP server. Values are `ssl', `network', `starttls' or `shell'.") @@ -263,7 +266,7 @@ ?s host ?p port))))) -(defun nnimap-credentials (address ports &optional inhibit-create) +(defun nnimap-credentials (address ports &optional inhibit-create username) (let (port credentials) ;; Request the credentials from all ports, but only query on the ;; last port if all the previous ones have failed. @@ -271,7 +274,7 @@ (setq port (pop ports))) (setq credentials (auth-source-user-or-password - '("login" "password") address port nil + '("login" "password") address port username (if inhibit-create nil (null ports))))) @@ -410,7 +413,7 @@ (nnoo-current-server 'nnimap) ports t) ;; Then look them up based on the ;; physical address. - (nnimap-credentials nnimap-address ports))))) + (nnimap-credentials nnimap-address ports nil nnimap-username))))) (setq nnimap-object nil) (setq login-result (nnimap-command "LOGIN %S %S" (car credentials) @@ -418,12 +421,12 @@ (unless (car login-result) ;; If the login failed, then forget the credentials ;; that are now possibly cached. - (dolist (host (list (nnoo-current-server 'nnimap) - nnimap-address)) + (dolist (host (list (list (nnoo-current-server 'nnimap) nil) + (list nnimap-address nnimap-username))) (dolist (port ports) (dolist (element '("login" "password")) (auth-source-forget-user-or-password - element host port)))) + element (car host) port (nth 1 host))))) (delete-process (nnimap-process nnimap-object)) (setq nnimap-object nil)))) (when nnimap-object