Function: erc-nickserv-get-password

erc-nickserv-get-password is a byte-compiled function defined in erc-services.el.gz.

Signature

(erc-nickserv-get-password NICK)

Documentation

Return the password for NICK from configured sources.

First, a password for NICK is looked up in erc-nickserv-passwords. Then, it is looked up in auth-source if erc-use-auth-source-for-nickserv-password is not nil. Finally, interactively prompt the user, if erc-prompt-for-nickserv-password is true.

As soon as some source returns a password, the sequence of lookups stops and this function returns it (or returns nil if it is empty). Otherwise, no corresponding password was found, and it returns nil.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-services.el.gz
(defun erc-nickserv-get-password (nick)
  "Return the password for NICK from configured sources.
First, a password for NICK is looked up in
`erc-nickserv-passwords'.  Then, it is looked up in auth-source
if `erc-use-auth-source-for-nickserv-password' is not nil.
Finally, interactively prompt the user, if
`erc-prompt-for-nickserv-password' is true.

As soon as some source returns a password, the sequence of
lookups stops and this function returns it (or returns nil if it
is empty).  Otherwise, no corresponding password was found, and
it returns nil."
  (when-let*
      ((nid (erc-networks--id-symbol erc-networks--id))
       (ret (or (when erc-nickserv-passwords
                  (assoc-default nick
                                 (cadr (assq nid erc-nickserv-passwords))))
                (when (and erc-use-auth-source-for-nickserv-password
                           erc-auth-source-services-function)
                  (funcall erc-auth-source-services-function :user nick))
                (when erc-prompt-for-nickserv-password
                  (read-passwd
                   (format "NickServ password for %s on %s (RET to cancel): "
                           nick nid)))))
       ((not (string-empty-p (erc--unfun ret)))))
    ret))