summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorTed Zlatanov <tzz@lifelogs.com>2011-02-12 11:51:02 -0600
committerTed Zlatanov <tzz@lifelogs.com>2011-02-12 11:51:02 -0600
commit563790b6db1fed5d81809ca826e19685b78461f4 (patch)
tree0115ee56f0b0046fca7b41b293c192ac06df3dc6 /lisp/mail
parent50fd938f33c9c5e91a407595ad9609379e46d11a (diff)
downloademacs-563790b6db1fed5d81809ca826e19685b78461f4.tar.gz
Use `auto-source-search' instead of `auto-source-user-or-password'.
* mail/smtpmail.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (smtpmail-try-auth-methods): Use it. * net/imap-hash.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (imap-hash-open-connection): Use it. * net/tramp-imap.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (tramp-imap-passphrase-callback-function): Use it. * net/tramp.el (tramp-default-method): Also check if `auth-source-search' is bound. (tramp-read-passwd): Use `auth-source-search' instead of `auto-source-user-or-password'. * url-parse.el (url-bit-for-url, url-user-for-url) (url-password-for-url): Use `auto-source-search' instead of `auto-source-user-or-password'. * url-auth.el: Autoload `auto-source-search' instead of `auto-source-user-or-password'. (url-basic-auth, url-digest-auth, url-do-auth-source-search): Use it.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/smtpmail.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f726304704b..427d9d17746 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -77,7 +77,7 @@
(autoload 'netrc-machine "netrc")
(autoload 'netrc-get "netrc")
(autoload 'password-read "password-cache")
-(autoload 'auth-source-user-or-password "auth-source")
+(autoload 'auth-source-search "auth-source")
;;;
(defgroup smtpmail nil
@@ -538,10 +538,14 @@ The list is in preference order.")
(defun smtpmail-try-auth-methods (process supported-extensions host port)
(let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
(mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
- (auth-user (auth-source-user-or-password
- "login" host (or port "smtp")))
- (auth-pass (auth-source-user-or-password
- "password" host (or port "smtp")))
+ (auth-info (auth-source-search :max 1
+ :host host
+ :port (or port "smtp")))
+ (auth-user (plist-get (nth 0 auth-info) :user))
+ (auth-pass (plist-get (nth 0 auth-info) :secret))
+ (auth-pass (if (functionp auth-pass)
+ (funcall auth-pass)
+ auth-pass))
(cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-*
(list host port auth-user auth-pass)
;; else, if auth-source didn't return them...