Function: erc-dcc-get-filter
erc-dcc-get-filter is a byte-compiled function defined in
erc-dcc.el.gz.
Signature
(erc-dcc-get-filter PROC STR)
Documentation
This is the process filter for transfers from other clients to this one.
It reads incoming bytes from the network and stores them in the DCC buffer, and sends back the replies after each block of data per the DCC protocol spec. Well not really. We write back a reply after each read, rather than every 1024 byte block, but nobody seems to care.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-get-filter (proc str)
"This is the process filter for transfers from other clients to this one.
It reads incoming bytes from the network and stores them in the DCC
buffer, and sends back the replies after each block of data per the DCC
protocol spec. Well not really. We write back a reply after each read,
rather than every 1024 byte block, but nobody seems to care."
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t)
received-bytes)
(goto-char (point-max))
(when str
(cl-assert (not (multibyte-string-p str)))
(insert str))
(when (> (point-max) erc-dcc-receive-cache)
(erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
(setq received-bytes (buffer-size))
(if erc-dcc-byte-count
(setq received-bytes (+ received-bytes erc-dcc-byte-count)))
(and erc-dcc-verbose
(erc-display-message
nil 'notice erc-server-process
'dcc-get-bytes-received
?f (file-name-nondirectory (buffer-name))
?b (number-to-string received-bytes)))
(cond
((and (> (plist-get erc-dcc-entry-data :size) 0)
(> received-bytes (plist-get erc-dcc-entry-data :size)))
(erc-display-message
nil '(notice error) 'active
'dcc-get-file-too-long
?f (file-name-nondirectory (buffer-name)))
(delete-process proc))
;; Some senders want us to hang up. Only observed w. TSEND.
((and (plist-get erc-dcc-entry-data :turbo)
(= received-bytes (plist-get erc-dcc-entry-data :size)))
(when erc-dcc--send-final-turbo-ack
(process-send-string proc (erc-pack-int received-bytes)))
(delete-process proc))
((not (or (plist-get erc-dcc-entry-data :turbo)
(process-get proc :reportingp)))
(process-put proc :reportingp t)
(process-send-string proc (erc-pack-int received-bytes))
(process-put proc :reportingp nil))))))