[gnus git] branch tzz-auth-source-rewrite updated: =1= Fixes for backwards compatibility and nconc misuse.

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  060d648dcb691ba9f4620e320b1cb8409c060fad (commit)
      from  909ea56c2351cc63c51ff5374761fb00343cee75 (commit)


- Log -----------------------------------------------------------------
commit 060d648dcb691ba9f4620e320b1cb8409c060fad
Author: Ted Zlatanov <[email protected]>
Date:   Mon Feb 7 14:27:11 2011 -0600

    Fixes for backwards compatibility and nconc misuse.
    
    * auth-source.el (auth-source-secrets-search)
    (auth-source-user-or-password): Use `append' instead of `nconc'.
    (auth-source-user-or-password): Build return list better and protect
    against nil :secret.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 61dcc31..93c41b6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-07  Teodor Zlatanov  <[email protected]>
+
+	* auth-source.el (auth-source-secrets-search)
+	(auth-source-user-or-password): Use `append' instead of `nconc'.
+	(auth-source-user-or-password): Build return list better and protect
+	against nil :secret.
+
 2011-02-06  Michael Albinus  <[email protected]>
 
 	* auth-source.el (top): Require 'eieio unconditionally.  Autoload
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index dfadc84..7ef6f97 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -96,8 +96,6 @@
                     :custom function
                     :documentation "The search function.")))
 
-;;(auth-source-backend "netrc" :type 'netrc)
-
 (defcustom auth-source-protocols '((imap "imap" "imaps" "143" "993")
                                    (pop3 "pop3" "pop" "pop3s" "110" "995")
                                    (ssh  "ssh" "22")
@@ -934,7 +932,7 @@ login:
          (items (subseq items 0 (min (length items) max)))
          ;; convert the item name to a full plist
          (items (mapcar (lambda (item)
-                          (nconc
+                          (append
                            ;; make an entry for the secret (password) element
                            (list
                             :secret
@@ -947,7 +945,7 @@ login:
                         items))
          ;; ensure each item has each key in `returned-keys'
          (items (mapcar (lambda (plist)
-                          (nconc
+                          (append
                            (mapcan (lambda (req)
                                      (if (plist-get plist req)
                                          nil
@@ -989,6 +987,8 @@ login:
 ;;    (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "tzz")
 ;;    (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "joe")))
 
+;;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" t "tzz")
+
 ;; deprecate this interface
 (make-obsolete 'auth-source-user-or-password 'auth-source-search "Emacs 24.1")
 
@@ -1018,6 +1018,7 @@ MODE can be \"login\" or \"password\"."
   (auth-source-do-debug
    "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s"
    mode host protocol username)
+
   (let* ((listy (listp mode))
          (mode (if listy mode (list mode)))
          (cname (if username
@@ -1048,12 +1049,17 @@ MODE can be \"login\" or \"password\"."
           found)                        ; return the found data
       ;; else, if not found, search with a max of 1
       (let ((choice (nth 0 (apply 'auth-source-search
-                                  (nconc '(:max 1) search)))))
+                                  (append '(:max 1) search)))))
         (when choice
-          (when (member "password" mode)
-            (push (funcall (plist-get :secret choice)) found))
-          (when (member "login" mode)
-            (push (funcall (plist-get :user choice)) found)))
+          (dolist (m mode)
+            (cond
+             ((equal "password" m)
+              (push (if (plist-get choice :secret)
+                      (funcall (plist-get choice :secret))
+                    nil) found))
+             ((equal "login" m)
+              (push (plist-get choice :user) found)))))
+        (setq found (nreverse found))
           (setq found (if listy found (car-safe found)))))
 
         found))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog      |    7 +++++++
 lisp/auth-source.el |   26 ++++++++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, tzz-auth-source-rewrite has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.