]> git.eshelyaron.com Git - emacs.git/commit
ERC: NickServ: Prompt for password last, overall simplifications (bug#46777)
authorOlivier Certner <olce.emacs@certner.fr>
Fri, 5 Feb 2021 14:34:50 +0000 (15:34 +0100)
committerAmin Bandali <bandali@gnu.org>
Fri, 17 Sep 2021 04:31:31 +0000 (00:31 -0400)
commitc6eb114a42922af18818dce7317238e0af776958
tree0435c4b6192f16213f657c079dad58e24eceb73a
parentf7ed946874c345d8e4ea2891d58160f1139548d6
ERC: NickServ: Prompt for password last, overall simplifications (bug#46777)

When 'erc-prompt-for-nickserv-password' is non-nil, 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').

* lisp/erc/erc-services.el (erc-nickserv-identify): Make the password
argument optional (and don't prompt for it interactively).  Further,
now take the nick to use for identification (interactively, ask for
it, defaulting to the current one).  Move the actual message sending
into the new 'erc-nickserv-send-identify' function, and the password
prompting into 'erc-nickserv-get-password'.

(erc-nickserv-send-identify): New function containing the code for
sending the identify message to NickServ, given the nick and password.

(erc-nickserv-get-password): Try each password source in turn, in the
following order: 'erc-nickserv-passwords', auth-source (if
'erc-use-auth-source-for-nickserv-password' is non-nil), and in the
end prompt the user interactively (if
'erc-prompt-for-nickserv-password' is non-nil).  If one source returns
a string, the function returns it, or nil if the string is empty.

(erc-nickserv-call-identify-function): Declare obsolete, but retain
for backward compatibility.  Prefer invoking 'erc-nickserv-identify'
directly instead.

(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' has been obsoleted).
For the last two functions, remove the redundant checks on the
NickServ identification flags (additionally, it is doubtful they have
any measurable impact on performance).

* etc/NEWS: Announce the change.

Co-authored-by: F. Jason Park <jp@neverwas.me>
etc/NEWS
lisp/erc/erc-services.el