Mercurial > emacs
diff lisp/gnus/auth-source.el @ 110586:867180d035b0
auth-source.el (auth-source-create): Query the user for whether to store the credentials.
auth-source.el: Require netrc.
nnml.el (nnml-open-nov): Don't return dead buffers.
gnus-picon.el (gnus-picon-xbm): Removed obsolete face.
gnus-picon.el (gnus-picon-insert-glyph): Make the background white.
gnus-art.el (gnus-treatment-function-alist): Insert picons after doing the header highlightling.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sun, 26 Sep 2010 13:25:35 +0000 |
parents | 677b6dea1d61 |
children | d2b45bb936b6 |
line wrap: on
line diff
--- a/lisp/gnus/auth-source.el Sun Sep 26 12:47:09 2010 +0000 +++ b/lisp/gnus/auth-source.el Sun Sep 26 13:25:35 2010 +0000 @@ -32,9 +32,9 @@ ;;; Code: (require 'gnus-util) +(require 'netrc) (eval-when-compile (require 'cl)) -(autoload 'netrc-machine-user-or-password "netrc") (autoload 'secrets-create-item "secrets") (autoload 'secrets-delete-item "secrets") (autoload 'secrets-get-alias "secrets") @@ -312,25 +312,41 @@ (setq result (mapcar (lambda (m) - (cond - ((equal "password" m) - (let ((passwd (read-passwd - (format "Password for %s on %s: " prot host)))) - (cond - ;; Secret Service API. - ((consp source) - (apply - 'secrets-create-item - (auth-get-source entry) name passwd spec)) - (t)) ;; netrc not implemented yes. - passwd)) - ((equal "login" m) - (or user - (read-string (format "User name for %s on %s: " prot host)))) - (t - "unknownuser"))) + (cons + m + (cond + ((equal "password" m) + (let ((passwd (read-passwd + (format "Password for %s on %s: " prot host)))) + (cond + ;; Secret Service API. + ((consp source) + (apply + 'secrets-create-item + (auth-get-source entry) name passwd spec)) + (t)) ;; netrc not implemented yes. + passwd)) + ((equal "login" m) + (or user + (read-string (format "User name for %s on %s: " prot host)))) + (t + "unknownuser")))) (if (consp mode) mode (list mode)))) - (if (consp mode) result (car result)))) + ;; Allow the source to save the data. + (cond + ((consp source) + ;; Secret Service API -- not implemented. + ) + (t + ;; netrc interface. + (when (y-or-n-p (format "Do you want to save this password in %s? " + source)) + (netrc-store-data source host prot + (or user (cdr (assoc "login" result))) + (cdr (assoc "password" result)))))) + (if (consp mode) + (mapcar #'cdr result) + (cdar result)))) (defun auth-source-delete (entry &rest spec) "Delete credentials according to SPEC in ENTRY."