NickServ identification: Prompt for password last, overall simplifications #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When `erc-prompt-for-nickserv-password' is true, don't ignore the
other forms of identification. Instead, process them first, and
prompt for the password last. Separate concerns (determination of the
nick to use, of the password to use, and actual message sending).
Note that the user can be interactively prompted for a password on
reception of a Nickserv request, as before (on
`erc-prompt-for-nickserv-password').
password anymore as an argument (and don't prompt for it
interactively). On the contrary, now take the nick to use for
identification (interactively, ask for it, defaulting to the current
one). Move actual message sending into the new
erc-nickserv-send-identify', and password prompting into
erc-nickserv-get-password'.(erc-nickserv-send-identify): New function containing the sending
code, given the nick and password.
(erc-nickserv-get-password): Try each password source in turn, in this
order:
erc-nickserv-passwords', auth-source (if
erc-use-auth-source-for-nickserv-password' is true), and in the endprompt the user interactively (if `erc-prompt-for-nickserv-password'
is true). If one source returns a string, the function returns it, or
nil if the string is empty.
(erc-nickserv-call-identify-function): Remove. It was necessary as a
cumbersome workaround for the fact that the code for password
prompting was in the
interactive' form of function
erc-nickserv-identify' before this change.(erc-nickserv-identify-autodetect, erc-nickserv-identify-on-connect)
(erc-nickserv-identify-on-nick-change): Call
erc-nickserv-identify' directly (
erc-nickserv-call-identify-function' was removed). For thelast two functions, remove the redundant checks on the Nickserv
identification flags (additionally, it is doubtful they have any
measurable impact on performance).