Delete duplicate server names when getting credentials.
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 17 Feb 2011 23:00:43 +0000 (15:00 -0800)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 17 Feb 2011 23:00:43 +0000 (15:00 -0800)
lisp/ChangeLog
lisp/gnus-util.el
lisp/nnimap.el

index 16247e0..d5fa15d 100644 (file)
@@ -1,7 +1,15 @@
+2011-02-17  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * nnimap.el (nnimap-open-connection-1): Delete duplicate server names
+       when getting credentials.
+
+       * gnus-util.el (gnus-delete-duplicates): New function.
+
 2011-02-17  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * nnimap.el (nnimap-credentials): Instead of picking the first port as
 2011-02-17  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * nnimap.el (nnimap-credentials): Instead of picking the first port as
-       a creation default, pass the whole port list down.  It will be completed.
+       a creation default, pass the whole port list down.  It will be
+       completed.
 
        * auth-source.el (auth-source-search): Updated docs to talk about
        multiple creation choices.
 
        * auth-source.el (auth-source-search): Updated docs to talk about
        multiple creation choices.
index 67c4909..42dbd59 100644 (file)
@@ -871,6 +871,15 @@ Bind `print-quoted' and `print-readably' to t, and `print-length' and
   (when (file-exists-p file)
     (delete-file file)))
 
   (when (file-exists-p file)
     (delete-file file)))
 
+(defun gnus-delete-duplicates (list)
+  "Remove duplicate entries from LIST."
+  (let ((result nil))
+    (while list
+      (unless (member (car list) result)
+       (push (car list) result))
+      (pop list))
+    (nreverse result)))
+
 (defun gnus-delete-directory (directory)
   "Delete files in DIRECTORY.  Subdirectories remain.
 If there's no subdirectory, delete DIRECTORY as well."
 (defun gnus-delete-directory (directory)
   "Delete files in DIRECTORY.  Subdirectories remain.
 If there's no subdirectory, delete DIRECTORY as well."
index 2412546..7f8ecc1 100644 (file)
@@ -384,9 +384,10 @@ textual parts.")
                                ;; Look for the credentials based on
                                ;; the virtual server name and the address
                                (nnimap-credentials
                                ;; Look for the credentials based on
                                ;; the virtual server name and the address
                                (nnimap-credentials
-                                (list
-                                 nnimap-address
-                                 (nnoo-current-server 'nnimap))
+                               (gnus-delete-duplicates
+                                (list
+                                 nnimap-address
+                                 (nnoo-current-server 'nnimap)))
                                 ports))))
                  (setq nnimap-object nil)
                (let ((nnimap-inhibit-logging t))
                                 ports))))
                  (setq nnimap-object nil)
                (let ((nnimap-inhibit-logging t))