From 26bd2f4ea882e9855470865abf853554920d34af Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 27 Nov 2022 16:02:19 -0800 Subject: [PATCH 0/3] *** NOT A PATCH *** *** BLURB HERE *** F. Jason Park (3): Add erc-sasl-auth-source-function to cached options * doc/misc/erc.texi: Revise SASL and modules chapters. Simplify erc-sasl's auth-source API doc/misc/erc.texi | 116 +++++++++++++++++++++++++++----- lisp/erc/erc-sasl.el | 77 +++++++++++++-------- test/lisp/erc/erc-sasl-tests.el | 61 ++++++++++------- 3 files changed, 186 insertions(+), 68 deletions(-) Interdiff: diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 6f9656ca6b..aa7b9cb947 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -1055,8 +1055,8 @@ SASL @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. There is one catch, though: if you -set @code{erc-sasl-auth-source-function} to a function, ERC will +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. @@ -1082,9 +1082,9 @@ SASL with everything else. @end defun -Regardless, so 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} parameter. +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 diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el index e149c94085..5b2c93988a 100644 --- a/lisp/erc/erc-sasl.el +++ b/lisp/erc/erc-sasl.el @@ -96,11 +96,11 @@ erc-sasl-auth-source-function "Function to query auth-source for an SASL password. If provided, this function should expect to be called with any number of keyword params known to `auth-source-search', even -though, as of ERC 5.5, these consists only of `:user' paired with -a \"resolved\" `erc-sasl-user' value. Additionally, all user -options defined this library, such as `erc-sasl-password', are -bound to their original values from module initialization. In -return, ERC expects a string to send as the SASL password, or +though ERC itself only specifies `:user' paired with a +\"resolved\" `erc-sasl-user' value. When calling this function, +ERC binds all options defined in this library, such as +`erc-sasl-password', to their values from entry-point invocation. +In return, ERC expects a string to send as the SASL password, or nil, in which case, ERC will prompt the for input. See info node `(erc) Connecting' for details on ERC's auth-source integration." @@ -137,7 +137,8 @@ erc-sasl-auth-source-password-as-host But only do so when it's a string or a non-nil symbol, unless that symbol is `:password', in which case, use a non-nil `erc-session-password' instead. Otherwise, just defer to -`erc-auth-source-search' to pick a suitable `:host'." +`erc-auth-source-search' to pick a suitable `:host'. Expect +PLIST to contain keyword params known to `auth-source-search'." (when erc-sasl-password (when-let ((host (if (eq :password erc-sasl-password) (and (not (functionp erc-session-password)) @@ -148,7 +149,7 @@ erc-sasl-auth-source-password-as-host (defun erc-sasl--read-password (prompt) "Return configured option or server password. -PROMPT is passed to `read-passwd' if necessary." +If necessary, pass PROMPT to `read-passwd'." (if-let ((found (pcase (alist-get 'password erc-sasl--options) ((guard (alist-get 'authfn erc-sasl--options)) (let-alist erc-sasl--options -- 2.38.1