emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/gnus/mail-source.el,v


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/mail-source.el,v
Date: Tue, 29 Apr 2008 01:03:35 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Miles Bader <miles>     08/04/29 01:03:33

Index: mail-source.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/mail-source.el,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- mail-source.el      26 Apr 2008 04:29:42 -0000      1.41
+++ mail-source.el      29 Apr 2008 01:03:33 -0000      1.42
@@ -451,19 +451,7 @@
 the `mail-source-keyword-map' variable."
   `(let* ,(mail-source-bind-1 (car type-source))
      (mail-source-set-1 ,(cadr type-source))
-     (let ((user (or
-                 (auth-source-user-or-password 
-                  "login"
-                  server             ; this is "host" in auth-sources
-                  ',(car type-source))
-                 user))
-          (password (or
-                     (auth-source-user-or-password 
-                      "password"
-                      server         ; this is "host" in auth-sources
-                      ',(car type-source))
-                     password)))
-       ,@body)))
+     ,@body))
 
 (put 'mail-source-bind 'lisp-indent-function 1)
 (put 'mail-source-bind 'edebug-form-spec '(sexp body))
@@ -471,14 +459,37 @@
 (defun mail-source-set-1 (source)
   (let* ((type (pop source))
         (defaults (cdr (assq type mail-source-keyword-map)))
-        default value keyword)
+        default value keyword 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
       (set (mail-source-strip-keyword (setq keyword (car default)))
-          (if (setq value (plist-get source keyword))
+          ;; note the following reasons for this structure:
+          ;; 1) the auth-sources user and password override everything
+          ;; 2) it avoids macros, so it's cleaner
+          ;; 3) it falls through to the mail-sources and then default values
+          (cond 
+           ((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)))
+            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)))
+            pass-auth)
+           (t (if (setq value (plist-get source keyword))
               (mail-source-value value)
-            (mail-source-value (cadr default)))))))
+              (mail-source-value (cadr default)))))))))
 
 (eval-and-compile
   (defun mail-source-bind-common-1 ()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]