diff options
author | F. Jason Park <jp@neverwas.me> | 2022-11-23 21:31:19 -0800 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2022-11-29 00:01:13 -0500 |
commit | 00de296d1b4f629fd828cdeff588bb4f742d9ffe (patch) | |
tree | 7b791016be2034d15c749ab0206957a164cbc389 /doc/misc/erc.texi | |
parent | 83b9496a193c41ed7e41b36838727e234c81a2d1 (diff) | |
download | emacs-00de296d1b4f629fd828cdeff588bb4f742d9ffe.tar.gz |
Simplify erc-sasl's auth-source API
* doc/misc/erc.texi: Revise descriptions in SASL chapter to reflect
simplified auth-source options.
* lisp/erc/erc-sasl.el (erc-sasl-password,
erc-sasl-auth-source-function): Revise doc strings.
(erc-sasl-auth-source-password-as-host): New function to serve as
more useful choice for option `erc-sasl-auth-source-function'.
(erc-sasl--read-password): Promote auth-source to pole position, above
an explicit string and `:password'.
* test/lisp/erc/erc-sasl-tests.el (erc-sasl--read-password--basic):
Massage tests to conform to simplified `erc-sasl-password'
API. (Bug#29108.)
Diffstat (limited to 'doc/misc/erc.texi')
-rw-r--r-- | doc/misc/erc.texi | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 2835baa3d6b..a8d1dd78235 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -1055,17 +1055,10 @@ borrowing that parameter for its own uses, thus allowing you to call @code{erc-tls} with @code{:password} set to your NickServ password. You can also set this to a nonemtpy string, and ERC will send that -when needed, no questions asked. If you instead give a non-@code{nil} -symbol (other than @code{:password}), like @samp{Libera.Chat}, ERC -will use it for the @code{:host} field in an auth-source query. -Actually, the same goes for when this option is @code{nil} but an -explicit session ID is already on file (@pxref{Network Identifier}). -For all such queries, ERC specifies the resolved value of -@code{erc-sasl-user} for the @code{:user} (@code{:login}) param. Keep -in mind that none of this matters unless -@code{erc-sasl-auth-source-function} holds a function, and it's -@code{nil} by default. As a last resort, ERC will prompt you for -input. +when needed, no questions asked. Or, if you'd rather use auth-source, +set @code{erc-sasl-auth-source-function} to a function, and ERC will +perform an auth-source query instead. As last resort in all cases, +ERC will prompt you for input. Lastly, if your mechanism is @code{ecdsa-nist256p-challenge}, this option should instead hold the file name of your key. @@ -1075,7 +1068,23 @@ option should instead hold the file name of your key. This is nearly identical to the other ERC @samp{auth-source} function options (@pxref{ERC auth-source functions}) except that the default value here is @code{nil}, meaning you have to set it to something like -@code{erc-auth-source-search} for queries to be performed. +@code{erc-auth-source-search} for queries to be performed. For +convenience, this module provides the following as a possible value: + +@defun erc-sasl-auth-source-password-as-host &rest plist +Setting @code{erc-sasl-auth-source-function} to this function tells +ERC to use @code{erc-sasl-password} for the @code{:host} field when +querying auth-source, even if its value is the default +@code{:password}, in which case ERC knows to ``resolve'' it to +@code{erc-session-password} and use that as long as it's +non-@code{nil}. Otherwise, ERC just defers to +@code{erc-auth-source-search} to determine the @code{:host}, along +with everything else. +@end defun + +As long as this option specifies a function, ERC will pass it the +``resolved'' value of @code{erc-sasl-user} for the auth-source +@code{:user} param. @end defopt @defopt erc-sasl-authzid @@ -1143,10 +1152,11 @@ machine Example.Net login aph-bot password sesame (erc-tls :server "irc.libera.chat" :port 6697 :client-certificate t))) ('example - (let ((erc-sasl-auth-source-function #'erc-auth-source-search) - (erc-sasl-password 'Example.Net)) + (let ((erc-sasl-auth-source-function + #'erc-sasl-auth-source-password-as-host)) (erc-tls :server "irc.example.net" :port 6697 - :user "alyssa"))))) + :user "alyssa" + :password "Example.Net"))))) @end lisp You've started storing your credentials with auth-source and have |