Function: erc-cmd-JOIN

erc-cmd-JOIN is a byte-compiled function defined in erc.el.gz.

Signature

(erc-cmd-JOIN CHANNEL &optional KEY)

Documentation

Join the channel given in CHANNEL, optionally with KEY.

If CHANNEL is specified as "-invite", join the channel to which you were most recently invited. See also invitation.

Aliases

erc-cmd-J erc-cmd-CHANNEL

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-JOIN (channel &optional key)
  "Join the channel given in CHANNEL, optionally with KEY.
If CHANNEL is specified as \"-invite\", join the channel to which you
were most recently invited.  See also `invitation'."
  (let (chnl)
    (if (string= (upcase channel) "-INVITE")
        (if erc-invitation
            (setq chnl erc-invitation)
          (erc-display-message nil 'error (current-buffer) 'no-invitation))
      (setq chnl (erc-ensure-channel-name channel)))
    (when chnl
      ;; Prevent double joining of same channel on same server.
      (let* ((joined-channels
              (mapcar (lambda (chanbuf)
                        (with-current-buffer chanbuf (erc-default-target)))
                      (erc-channel-list erc-server-process)))
             (server (with-current-buffer (process-buffer erc-server-process)
		       (or erc-session-server erc-server-announced-name)))
             (chnl-name (car (erc-member-ignore-case chnl joined-channels))))
        (if chnl-name
            (switch-to-buffer (if (get-buffer chnl-name)
                                  chnl-name
                                (concat chnl-name "/" server)))
	  (erc-server-join-channel server chnl key)))))
  t)