Function: erc-select-read-args
erc-select-read-args is an autoloaded and byte-compiled function
defined in erc.el.gz.
Signature
(erc-select-read-args)
Documentation
Prompt the user for values of nick, server, port, and password.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
;;;###autoload
(defun erc-select-read-args ()
"Prompt the user for values of nick, server, port, and password."
(require 'url-parse)
(let* ((input (let ((d (erc-compute-server)))
(read-string (format "Server (default is %S): " d)
nil 'erc-server-history-list d)))
;; For legacy reasons, also accept a URL without a scheme.
(url (url-generic-parse-url (erc--ensure-url input)))
(server (url-host url))
(sp (and (string-suffix-p "s" (url-type url)) erc-default-port-tls))
(port (or (url-portspec url)
(erc-compute-port
(let ((d (erc-compute-port sp))) ; may be a string
(read-string (format "Port (default is %s): " d)
nil nil d)))))
;; Trust the user not to connect twice accidentally. We
;; can't use `erc-already-logged-in' to check for an existing
;; connection without modifying it to consider USER and PASS.
(nick (or (url-user url)
(let ((d (erc-compute-nick)))
(read-string (format "Nickname (default is %S): " d)
nil 'erc-nick-history-list d))))
(passwd (let* ((p (with-suppressed-warnings ((obsolete erc-password))
(or (url-password url) erc-password)))
(m (if p
(format "Server password (default is %S): " p)
"Server password (optional): ")))
(if erc-prompt-for-password (read-passwd m nil p) p))))
(when (and passwd (string= "" passwd))
(setq passwd nil))
(when (and (equal server erc-default-server)
(eql port erc-default-port)
(not (eql port erc-default-port-tls)) ; not `erc-tls'
(not (string-prefix-p "irc://" input))) ; not yanked URL
(add-hook 'erc--server-post-connect-hook #'erc--warn-unencrypted))
(list :server server :port port :nick nick :password passwd)))