Function: erc-dcc-get-sentinel

erc-dcc-get-sentinel is a byte-compiled function defined in erc-dcc.el.gz.

Signature

(erc-dcc-get-sentinel PROC EVENT)

Documentation

This is the process sentinel for CTCP DCC SEND connections.

It shuts down the connection and notifies the user that the transfer is complete.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-get-sentinel (proc event)
  "This is the process sentinel for CTCP DCC SEND connections.
It shuts down the connection and notifies the user that the
transfer is complete."
  ;; FIXME, we should look at EVENT, and also check size.
  (unless (member event '("connection broken by remote peer\n"
                          "deleted\n"))
    (lwarn 'erc :warning "Unexpected sentinel event %S for %s"
           (string-trim-right event) proc))
  (with-current-buffer (process-buffer proc)
    (delete-process proc)
    (setq erc-dcc-list (delete erc-dcc-entry-data erc-dcc-list))
    (unless (= (point-min) (point-max))
      (erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
    (let ((done (= erc-dcc-byte-count (plist-get erc-dcc-entry-data :size))))
      (erc-display-message
       nil (if done 'notice '(notice error)) erc-server-process
       (if done 'dcc-get-complete 'dcc-get-failed)
       ?v (plist-get erc-dcc-entry-data :size)
       ?f erc-dcc-file-name
       ?s (number-to-string erc-dcc-byte-count)
       ?t (format "%.0f"
                  (erc-time-diff (plist-get erc-dcc-entry-data :start-time)
                                 nil))))
    (kill-buffer)))