From fb7e9e0539eabe1b5135fd793cbba20d87ebc1d2 Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Tue, 10 Jan 2012 22:04:51 +0000 Subject: nntp.el (nntp-send-authinfo): Query `auth-source-search' with the logical server name in addition to the actual machine address. auth-source.el (auth-source-user-and-password): Add convenience wrapper to search by just host and optionally user. --- lisp/gnus/auth-source.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lisp/gnus/auth-source.el') diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index acbc541512f..5e946372d04 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -1781,6 +1781,26 @@ MODE can be \"login\" or \"password\"." found)) +(defun auth-source-user-and-password (host &optional user) + (let* ((auth-info (car + (if user + (auth-source-search + :host host + :user "yourusername" + :max 1 + :require '(:user :secret) + :create nil) + (auth-source-search + :host host + :max 1 + :require '(:user :secret) + :create nil)))) + (user (plist-get auth-info :user)) + (password (plist-get auth-info :secret))) + (when (functionp password) + (setq password (funcall password))) + (list user password auth-info))) + (provide 'auth-source) ;;; auth-source.el ends here -- cgit v1.2.3