[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Committing new smtpmail.el later tonight
From: |
Ted Zlatanov |
Subject: |
Re: Committing new smtpmail.el later tonight |
Date: |
Wed, 22 Jun 2011 15:27:13 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Wed, 22 Jun 2011 21:24:00 +0200 Lars Magne Ingebrigtsen <address@hidden>
wrote:
LMI> Ted Zlatanov <address@hidden> writes:
>> At least for netrc files, :create should DTRT as you describe. It's
>> used that way in nnimap.el:
LMI> If I had
LMI> machine foo port bar login zot
LMI> and used
LMI> (auth-source-search :max 1
LMI> :host "foo"
LMI> :port "bar"
LMI> :require '(:user :secret))
LMI> it wouldn't return anything,
LMI> and if I added
LMI> :create t
LMI> then it would prompt for both the user name and the secret.
Didn't we do this for nnimap.el? It saves the netrc line only if the
login is successful. You can do a preliminary search to see if you find
the :host and :port without :max; if so you can fill the :user into the
`auth-source-creation-defaults' dynamic override.
So, something like the following untested code, partly from
`nnimap-credentials':
#+begin_src text
(let* ((users (delq nil
(loop for result
in (auth-source-search :host "foo":port "bar")
collect (plist-get result :user))))
(auth-source-creation-prompts
'((user . "SMTP user at %h: ")
(secret . "SMTP password for address@hidden: ")))
(auth-source-creation-defaults
'((user . (nth 0 users))))
(found (nth 0 (auth-source-search :max 1
:host "foo"
:port "bar"
:user users
:require '(:user :secret)
:create t))))
(if found
(list (plist-get found :user)
(let ((secret (plist-get found :secret)))
(if (functionp secret)
(funcall secret)
secret))
(plist-get found :save-function))
nil))
#+end_src
This will create a new line iff you call the :save-function.
LMI> I think my latest changes to auth-source fixes this, but I'd appreciate
LMI> it if you'd go over the changes and check whether I was misunderstanding
LMI> something in the code. :-)
I think they are reasonable. But maybe the above will work? It seems
to me it would work for `nnimap-credentials' as well, which perhaps
argues that it should be in the auth-source API.
Ted
- Re: Committing new smtpmail.el later tonight, (continued)
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Robert Pluim, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Robert Pluim, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Robert Pluim, 2011/06/23
- Re: Committing new smtpmail.el later tonight, Ted Zlatanov, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight,
Ted Zlatanov <=
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Ted Zlatanov, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Eli Zaretskii, 2011/06/21
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Robert Pluim, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Eli Zaretskii, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Ted Zlatanov, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Eli Zaretskii, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Lars Magne Ingebrigtsen, 2011/06/22
- Re: Committing new smtpmail.el later tonight, Ted Zlatanov, 2011/06/22