diff lisp/gnus/nnimap.el @ 110587:e474d7d76259

Merge changes made in Gnus trunk. gnus-picon.el (gnus-picon-create-glyph): Set the background XPM colour explicitly. message.el (message-cite-prefix-regexp): Remove } from the cite prefix. gnus-win.el (gnus-window-to-buffer-helper, gnus-all-windows-visible-p): Function needn't be a symbol. mail-source.el (mail-source-value): Function needn't be a symbol. tls.el (open-tls-stream): Don't query killing process. gnus-win.el: Revert previous patch, since it made Gnus backtrace. nnimap.el: Look up IMAP credentials based on both the virtual and physical server names. mail-source.el (mail-source-value): Revert previous patch.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 26 Sep 2010 14:35:50 +0000
parents b6d2a63ad993
children 415e87a42437
line wrap: on
line diff
--- a/lisp/gnus/nnimap.el	Sun Sep 26 13:25:35 2010 +0000
+++ b/lisp/gnus/nnimap.el	Sun Sep 26 14:35:50 2010 +0000
@@ -238,7 +238,7 @@
 		     ?s host
 		     ?p port)))))
 
-(defun nnimap-credentials (address ports)
+(defun nnimap-credentials (address ports &optional inhibit-create)
   (let (port credentials)
     ;; Request the credentials from all ports, but only query on the
     ;; last port if all the previous ones have failed.
@@ -246,7 +246,10 @@
 		(setq port (pop ports)))
       (setq credentials
 	    (auth-source-user-or-password
-	     '("login" "password") address port nil (null ports))))
+	     '("login" "password") address port nil
+	     (if inhibit-create
+		 nil
+	       (null ports)))))
     credentials))
 
 (defun nnimap-keepalive ()
@@ -318,16 +321,21 @@
 	  (when (eq nnimap-stream 'starttls)
 	    (nnimap-command "STARTTLS")
 	    (starttls-negotiate (nnimap-process nnimap-object)))
+	  (when nnimap-server-port
+	    (push (format "%s" nnimap-server-port) ports))
 	  (unless (equal connection-result "PREAUTH")
 	    (if (not (setq credentials
 			   (if (eq nnimap-authenticator 'anonymous)
 			       (list "anonymous"
 				     (message-make-address))
-			     (nnimap-credentials
-			      nnimap-address
-			      (if nnimap-server-port
-				  (cons (format "%s" nnimap-server-port) ports)
-				ports)))))
+			     (or
+			      ;; First look for the credentials based
+			      ;; on the virtual server name.
+			      (nnimap-credentials
+			       (nnoo-current-server 'nnimap) ports t)
+			      ;; Then look them up based on the
+			      ;; physical address.
+			      (nnimap-credentials nnimap-address ports)))))
 		(setq nnimap-object nil)
 	      (setq login-result (nnimap-command "LOGIN %S %S"
 						 (car credentials)