Function: erc-cmd-PART

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

Signature

(erc-cmd-PART LINE)

Documentation

When LINE is an empty string, leave the current channel.

Otherwise leave the channel indicated by LINE.

Aliases

erc-cmd-LEAVE

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-PART (line)
  "When LINE is an empty string, leave the current channel.
Otherwise leave the channel indicated by LINE."
  (cond
   ((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-?\\(.*\\)$" line)
    (let* ((ch (match-string 1 line))
           (msg (match-string 2 line))
           (reason (funcall erc-part-reason (if (equal msg "") nil msg))))
      (erc-log (format "cmd: PART: %s: %s" ch reason))
      (erc-server-send (if (string= reason "")
                           (format "PART %s" ch)
                         (format "PART %s :%s" ch reason))
                       nil ch))
    t)
   ((string-match "^\\s-*\\(.*\\)$" line)
    (let* ((ch (erc-default-target))
           (msg (match-string 1 line))
           (reason (funcall erc-part-reason (if (equal msg "") nil msg))))
      (if (and ch (erc-channel-p ch))
          (progn
            (erc-log (format "cmd: PART: %s: %s" ch reason))
            (erc-server-send (if (string= reason "")
                                 (format "PART %s" ch)
                               (format "PART %s :%s" ch reason))
                             nil ch))
        (erc-display-message nil 'error (current-buffer) 'no-target)))
    t)
   (t nil)))