summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-sasl.el
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2022-11-23 21:31:19 -0800
committerAmin Bandali <bandali@gnu.org>2022-11-28 23:56:04 -0500
commit35e2b8a26be06ac1e563801eeb2193c57fd1189d (patch)
treefa180ea6e783e816f54700b1153f50c0cb506fbd /lisp/erc/erc-sasl.el
parent7336520fe774f7f7f5209c884e04911514bae796 (diff)
downloademacs-35e2b8a26be06ac1e563801eeb2193c57fd1189d.tar.gz
emacs-35e2b8a26be06ac1e563801eeb2193c57fd1189d.tar.bz2
emacs-35e2b8a26be06ac1e563801eeb2193c57fd1189d.zip
Add erc-sasl-auth-source-function to cached options
* lisp/erc/erc-sasl.el (erc-sasl--read-password): Consult cached options instead of `erc-sasl-auth-source-function'. (erc-sasl--init): Add `erc-sasl-auth-source-function' to `erc-sasl--options'. * test/lisp/erc/erc-sasl-tests.el (erc-sasl--read-password--basic, erc-sasl--read-password--auth-source): Look for original value of `erc-sasl-auth-source-function' in `erc-sasl--options' under the `authfn' key.
Diffstat (limited to 'lisp/erc/erc-sasl.el')
-rw-r--r--lisp/erc/erc-sasl.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el
index 9084d873ce4..5ee7169de5f 100644
--- a/lisp/erc/erc-sasl.el
+++ b/lisp/erc/erc-sasl.el
@@ -137,10 +137,11 @@ PROMPT is passed to `read-passwd' if necessary."
((found (pcase (alist-get 'password erc-sasl--options)
(:password erc-session-password)
((and (pred stringp) v) (unless (string-empty-p v) v))
- ((and (guard erc-sasl-auth-source-function)
- v (let host
- (or v (erc-networks--id-given erc-networks--id))))
- (apply erc-sasl-auth-source-function
+ ((and (let fn (alist-get 'authfn erc-sasl--options))
+ (guard fn) v
+ (let host
+ (or v (erc-networks--id-given erc-networks--id))))
+ (apply fn
:user (erc-sasl--get-user)
(and host (list :host (symbol-name host))))))))
(copy-sequence (erc--unfun found))
@@ -293,6 +294,7 @@ PROMPT is passed to `read-passwd' if necessary."
`((user . ,erc-sasl-user)
(password . ,erc-sasl-password)
(mechanism . ,erc-sasl-mechanism)
+ (authfn . ,erc-sasl-auth-source-function)
(authzid . ,erc-sasl-authzid)))))
(defun erc-sasl--mechanism-offered-p (offered)