[gnus git] branch master updated: =1= (auth-source-search): Do a two-phase search, one with no :create to get the responses from all backends.
Lars Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 747da72a4e98056d9da1881012390a788ffdc0bd (commit)
from a0faaaf767280ba530f2c5c76fd25087581f62b8 (commit)
- Log -----------------------------------------------------------------
commit 747da72a4e98056d9da1881012390a788ffdc0bd
Author: Lars Ingebrigtsen <[email protected]>
Date: Thu Feb 17 15:45:12 2011 -0800
(auth-source-search): Do a two-phase search, one with no :create to get the responses from all backends.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d5fa15d..3b4f571 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2011-02-17 Lars Ingebrigtsen <[email protected]>
+ * auth-source.el (auth-source-search): Do a two-phase search, one with
+ no :create to get the responses from all backends.
+
* nnimap.el (nnimap-open-connection-1): Delete duplicate server names
when getting credentials.
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 8c34591..239ebed 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -510,7 +510,7 @@ must call it to obtain the actual value."
unless (memq (nth i spec) ignored-keys)
collect (nth i spec)))
(found (auth-source-recall spec))
- filtered-backends accessor-key found-here goal)
+ filtered-backends accessor-key found-here goal matches)
(if (and found auth-source-do-cache)
(auth-source-do-debug
@@ -539,14 +539,33 @@ must call it to obtain the actual value."
;; (debug spec "filtered" filtered-backends)
(setq goal max)
+ ;; First go through all the backends without :create, so we can
+ ;; query them all.
+ (let ((uspec (copy-sequence spec)))
+ (plist-put uspec :create nil)
(dolist (backend filtered-backends)
- (setq found-here (apply
+ (let ((match (apply
+ (slot-value backend 'search-function)
+ :backend backend
+ uspec)))
+ (when match
+ (push (list backend match) matches)))))
+ ;; If we didn't find anything, then we allow the backend(s) to
+ ;; create the entries.
+ (unless matches
+ (let ((match (apply
(slot-value backend 'search-function)
:backend backend
:create create
:delete delete
- spec))
+ spec)))
+ (when match
+ (push (list backend match) matches))))
+
+ (setq backend (caar matches)
+ found-here (cadar matches))
+ (block nil
;; if max is 0, as soon as we find something, return it
(when (and (zerop max) (> 0 (length found-here)))
(return t))
@@ -565,10 +584,10 @@ must call it to obtain the actual value."
(return found))
;; change the :max parameter in the spec to the goal
- (setq spec (plist-put spec :max goal)))
+ (setq spec (plist-put spec :max goal))
(when (and found auth-source-do-cache)
- (auth-source-remember spec found)))
+ (auth-source-remember spec 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 | 3 ++
lisp/auth-source.el | 85 +++++++++++++++++++++++++++++++--------------------
2 files changed, 55 insertions(+), 33 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, master has been updated
hooks/post-receive
--
Gnus Project