Function: nntp-send-authinfo
nntp-send-authinfo is a byte-compiled function defined in nntp.el.gz.
Signature
(nntp-send-authinfo &optional SEND-IF-FORCE)
Documentation
Send the AUTHINFO to the nntp server.
It will look in the "~/.authinfo" file for matching entries. If nothing suitable is found there, it will prompt for a user name and a password.
If SEND-IF-FORCE, only send authinfo to the server if the
.authinfo file has the FORCE token.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nntp.el.gz
(defun nntp-send-authinfo (&optional send-if-force)
"Send the AUTHINFO to the nntp server.
It will look in the \"~/.authinfo\" file for matching entries. If
nothing suitable is found there, it will prompt for a user name
and a password.
If SEND-IF-FORCE, only send authinfo to the server if the
.authinfo file has the FORCE token."
(let* ((auth-info
(nth 0 (auth-source-search
:max 1
:host (list nntp-address (nnoo-current-server 'nntp))
:port `("119" "nntp" ,(format "%s" nntp-port-number)
"563" "nntps" "snews"))))
(auth-user (plist-get auth-info :user))
(passwd (auth-info-password auth-info))
(force (or nntp-authinfo-force (plist-get auth-info :force)))
(user (or auth-user nntp-authinfo-user)))
(when (or (not send-if-force)
force)
(unless user
(setq user (read-string (format "NNTP (%s) user name: " nntp-address))
nntp-authinfo-user user))
(unless (member user '(nil ""))
(nntp-send-command "^3.*\r?\n" "AUTHINFO USER" user)
(let ((result
(nntp-send-command
"^2.*\r?\n" "AUTHINFO PASS"
(or passwd
nntp-authinfo-password
(setq nntp-authinfo-password
(read-passwd (format "NNTP (%s@%s) password: "
user nntp-address)))))))
(if (not result)
(error "Password rejected")
result))))))