Function: erc-select-read-args

erc-select-read-args is a 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."
  (let (user-input server port nick passwd)
    (setq user-input (read-string
                      "IRC server: "
                      (erc-compute-server) 'erc-server-history-list))

    (if (string-match "\\(.*\\):\\(.*\\)\\'" user-input)
        (setq port (erc-string-to-port (match-string 2 user-input))
              user-input (match-string 1 user-input))
      (setq port
            (erc-string-to-port (read-string
                                 "IRC port: " (erc-port-to-string
                                               (erc-compute-port))))))

    (if (string-match "\\`\\(.*\\)@\\(.*\\)" user-input)
        (setq nick (match-string 1 user-input)
              user-input (match-string 2 user-input))
      (setq nick
            (if (erc-already-logged-in server port nick)
                (read-string
                 (erc-format-message 'nick-in-use ?n nick)
                 nick 'erc-nick-history-list)
              (read-string
               "Nickname: " (erc-compute-nick nick)
               'erc-nick-history-list))))

    (setq server user-input)

    (setq passwd (if erc-prompt-for-password
                     (if (and erc-password
                              (y-or-n-p "Use the default password? "))
                         erc-password
                       (read-passwd "Password: "))
                   erc-password))
    (when (and passwd (string= "" passwd))
      (setq passwd nil))

    (while (erc-already-logged-in server port nick)
      ;; hmm, this is a problem when using multiple connections to a bnc
      ;; with the same nick. Currently this code prevents using more than one
      ;; bnc with the same nick. actually it would be nice to have
      ;; bncs transparent, so that erc-compute-buffer-name displays
      ;; the server one is connected to.
      (setq nick (read-string
                  (erc-format-message 'nick-in-use ?n nick)
                  nick 'erc-nick-history-list)))
    (list :server server :port port :nick nick :password passwd)))