[gnus git] branch master updated: n0-17-128-g3ea72fb =1= auth-source.el (plstore-delete): Autoload. (auth-source-plstore-search): Support delete operation. plstore.el (plstore-delete): New function.
Katsumi Yamaoka <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 3ea72fb7b847f08d8b64550409bcf5baedb94fec (commit)
from 9016000ed04df0c8ca8694f63f1973bd0311fcac (commit)
- Log -----------------------------------------------------------------
commit 3ea72fb7b847f08d8b64550409bcf5baedb94fec
Author: Daiki Ueno <[email protected]>
Date: Fri Jul 1 07:47:34 2011 +0000
auth-source.el (plstore-delete): Autoload.
(auth-source-plstore-search): Support delete operation.
plstore.el (plstore-delete): New function.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8580c0e..a527f60 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-01 Daiki Ueno <[email protected]>
+
+ * auth-source.el (plstore-delete): Autoload.
+ (auth-source-plstore-search): Support delete operation.
+ * plstore.el (plstore-delete): New function.
+
2011-07-01 Katsumi Yamaoka <[email protected]>
* gnus-draft.el (gnus-draft-clear-marks): Revert last change;
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index fd54c5a..52c9b17 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -70,6 +70,7 @@
(autoload 'plstore-open "plstore")
(autoload 'plstore-find "plstore")
(autoload 'plstore-put "plstore")
+(autoload 'plstore-delete "plstore")
(autoload 'plstore-save "plstore")
(autoload 'plstore-get-file "plstore")
@@ -1533,11 +1534,6 @@ authentication tokens:
type max host user port
&allow-other-keys)
"Search the PLSTORE; spec is like `auth-source'."
-
- ;; TODO
- (assert (not delete) nil
- "The PLSTORE auth-source backend doesn't support deletion yet")
-
(let* ((store (oref backend data))
(max (or max 5000)) ; sanity check: default to stop at 5K
(ignored-keys '(:create :delete :max :backend :require))
@@ -1561,6 +1557,7 @@ authentication tokens:
'(:host :login :port :secret)
search-keys)))
(items (plstore-find store search-spec))
+ (item-names (mapcar #'car items))
(items (butlast items (- (length items) max)))
;; convert the item to a full plist
(items (mapcar (lambda (item)
@@ -1584,8 +1581,9 @@ authentication tokens:
returned-keys))
plist))
items)))
+ (cond
;; if we need to create an entry AND none were found to match
- (when (and create
+ ((and create
(not items))
;; create based on the spec and record the value
@@ -1599,6 +1597,11 @@ authentication tokens:
;; the result will be returned, even if the search fails
(apply 'auth-source-plstore-search
(plist-put spec :create nil)))))
+ ((and delete
+ item-names)
+ (dolist (item-name item-names)
+ (plstore-delete store item-name))
+ (plstore-save store)))
items))
(defun* auth-source-plstore-create (&rest spec
diff --git a/lisp/plstore.el b/lisp/plstore.el
index 360388d..8d973a9 100644
--- a/lisp/plstore.el
+++ b/lisp/plstore.el
@@ -337,6 +337,24 @@ SECRET-KEYS is a plist containing secret data."
(cons (cons name secret-plist) (plstore--get-secret-alist plstore)))))
(plstore--merge-secret plstore)))
+(defun plstore-delete (plstore name)
+ "Delete an entry with NAME from PLSTORE."
+ (let ((entry (assoc name (plstore--get-alist plstore))))
+ (if entry
+ (plstore--set-alist
+ plstore
+ (delq entry (plstore--get-alist plstore))))
+ (setq entry (assoc name (plstore--get-secret-alist plstore)))
+ (if entry
+ (plstore--set-secret-alist
+ plstore
+ (delq entry (plstore--get-secret-alist plstore))))
+ (setq entry (assoc name (plstore--get-merged-alist plstore)))
+ (if entry
+ (plstore--set-merged-alist
+ plstore
+ (delq entry (plstore--get-merged-alist plstore))))))
+
(defvar pp-escape-newlines)
(defun plstore-save (plstore)
"Save the contents of PLSTORE associated with a FILE."
-----------------------------------------------------------------------
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 | 6 ++++++
lisp/auth-source.el | 19 +++++++++++--------
lisp/plstore.el | 18 ++++++++++++++++++
3 files changed, 35 insertions(+), 8 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