Function: erc-process-sentinel

erc-process-sentinel is a byte-compiled function defined in erc-backend.el.gz.

Signature

(erc-process-sentinel CPROC EVENT)

Documentation

Sentinel function for ERC process.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(defun erc-process-sentinel (cproc event)
  "Sentinel function for ERC process."
  (let ((buf (process-buffer cproc)))
    (when (buffer-live-p buf)
      (with-current-buffer buf
        (erc-log (format
                  "SENTINEL: proc: %S    status: %S  event: %S (quitting: %S)"
                  cproc (process-status cproc) event erc-server-quitting))
        (if (string-match "^open" event)
            ;; newly opened connection (no wait)
            (erc--register-connection)
          ;; assume event is 'failed
          (erc-with-all-buffers-of-server cproc nil
            (setq erc-server-connected nil))
          (when erc-server-ping-handler
            (progn (cancel-timer erc-server-ping-handler)
                   (setq erc-server-ping-handler nil)))
          (run-hook-with-args 'erc-disconnected-hook
                              (erc-current-nick) (system-name) "")
          (erc-with-all-buffers-of-server cproc (lambda () erc-channel-members)
            (when (erc--target-channel-p erc--target)
              (setf (erc--target-channel-joined-p erc--target) nil))
            (clrhash erc-channel-members))
          ;; Hide the prompt
          (erc--hide-prompt cproc)
          ;; Decide what to do with the buffer
          ;; Restart if disconnected
          (erc-process-sentinel-1 event buf))))))