* nnmairix.el: Remove old documentation in the commentary block.
[gnus] / lisp / mail-source.el
index c6c8d6b..7dbe30b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mail-source.el --- functions for fetching mail
 
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
@@ -453,10 +453,11 @@ the `mail-source-keyword-map' variable."
 (put 'mail-source-bind 'lisp-indent-function 1)
 (put 'mail-source-bind 'edebug-form-spec '(sexp body))
 
+;; TODO: use the list format for auth-source-user-or-password modes
 (defun mail-source-set-1 (source)
   (let* ((type (pop source))
         (defaults (cdr (assq type mail-source-keyword-map)))
-        default value keyword user-auth pass-auth)
+        default value keyword auth-info user-auth pass-auth)
     (while (setq default (pop defaults))
       ;; for each default :SYMBOL, set SYMBOL to the plist value for :SYMBOL
       ;; using `mail-source-value' to evaluate the plist value
@@ -469,20 +470,21 @@ the `mail-source-keyword-map' variable."
            ((and
             (eq keyword :user)
             (setq user-auth 
-                  (auth-source-user-or-password
-                   "login"
-                   ;; this is "host" in auth-sources
-                   (if (boundp 'server) (symbol-value 'server) "")
-                   type)))
+                  (nth 0 (auth-source-user-or-password
+                          '("login" "password")
+                          ;; this is "host" in auth-sources
+                          (if (boundp 'server) (symbol-value 'server) "")
+                          type))))
             user-auth)
            ((and
-            (eq keyword :password)
-            (setq pass-auth 
-                  (auth-source-user-or-password
-                   "password"
-                   ;; this is "host" in auth-sources
-                   (if (boundp 'server) (symbol-value 'server) "")
-                   type)))
+             (eq keyword :password)
+             (setq pass-auth
+                   (nth 1
+                        (auth-source-user-or-password
+                         '("login" "password")
+                         ;; this is "host" in auth-sources
+                         (if (boundp 'server) (symbol-value 'server) "")
+                         type))))
             pass-auth)
            (t (if (setq value (plist-get source keyword))
                 (mail-source-value value)