emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104678: (smtpmail-try-auth-methods):


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104678: (smtpmail-try-auth-methods): If the user has stored a user name, then
Date: Wed, 22 Jun 2011 21:24:51 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104678
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-22 21:24:51 +0200
message:
  (smtpmail-try-auth-methods): If the user has stored a user name, then
  query for the password first, instead of waiting for SMTP to give an
  error message and the trying again.
modified:
  lisp/ChangeLog
  lisp/mail/smtpmail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-22 16:44:53 +0000
+++ b/lisp/ChangeLog    2011-06-22 19:24:51 +0000
@@ -1,3 +1,9 @@
+2011-06-22  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * mail/smtpmail.el (smtpmail-try-auth-methods): If the user has
+       stored a user name, then query for the password first, instead of
+       waiting for SMTP to give an error message and the trying again.
+
 2011-06-22  Lawrence Mitchell  <address@hidden>
 
        * net/browse-url.el (browse-url-xdg-open): Use 0, rather than nil

=== modified file 'lisp/mail/smtpmail.el'
--- a/lisp/mail/smtpmail.el     2011-06-22 14:48:31 +0000
+++ b/lisp/mail/smtpmail.el     2011-06-22 19:24:51 +0000
@@ -477,6 +477,10 @@
 
 (defun smtpmail-try-auth-methods (process supported-extensions host port
                                          &optional ask-for-password)
+  (setq port
+       (if port
+           (format "%s" port)
+         "smtp"))
   (let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
         (mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
         (auth-source-creation-prompts
@@ -486,9 +490,7 @@
                     (auth-source-search
                      :max 1
                      :host host
-                     :port (if port
-                               (format "%s" port)
-                             "smtp")
+                     :port port
                      :require (and ask-for-password
                                    '(:user :secret))
                      :create ask-for-password)))
@@ -497,6 +499,20 @@
         (save-function (and ask-for-password
                             (plist-get auth-info :save-function)))
         ret)
+    (when (and user
+              (not password))
+      ;; The user has stored the user name, but not the password, so
+      ;; ask for the password, even if we're not forcing that through
+      ;; `ask-for-password'.
+      (setq auth-info
+           (car
+            (auth-source-search
+             :max 1
+             :host host
+             :port port
+             :require '(:user :secret)
+             :create t))
+           password (plist-get auth-info :secret)))
     (when (functionp password)
       (setq password (funcall password)))
     (cond


reply via email to

[Prev in Thread] Current Thread [Next in Thread]