Function: erc-dcc-get-file
erc-dcc-get-file is a byte-compiled function defined in erc-dcc.el.gz.
Signature
(erc-dcc-get-file ENTRY FILE PARENT-PROC)
Documentation
Set up a transfer from the remote client to the local over a TCP connection.
This involves setting up a process filter and a process sentinel, and making the connection.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-get-file (entry file parent-proc)
"Set up a transfer from the remote client to the local over a TCP connection.
This involves setting up a process filter and a process sentinel,
and making the connection."
(let* ((buffer (generate-new-buffer (file-name-nondirectory file)))
proc)
(with-current-buffer buffer
(fundamental-mode)
(buffer-disable-undo (current-buffer))
;; This is necessary to have the buffer saved as-is in GNU
;; Emacs.
(set-buffer-multibyte nil)
(setq mode-line-process '(":%s")
buffer-read-only t)
(setq erc-dcc-file-name file)
;; Truncate the given file to size 0 before appending to it.
(let ((inhibit-file-name-handlers
(append '(jka-compr-handler image-file-handler)
inhibit-file-name-handlers))
(inhibit-file-name-operation 'write-region))
(write-region (point) (point) erc-dcc-file-name nil 'nomessage))
(setq erc-server-process parent-proc)
(setq erc-dcc-byte-count 0)
(setq proc
(funcall erc-dcc-connect-function
"dcc-get" buffer
(plist-get entry :ip)
(string-to-number (plist-get entry :port))
entry))
(set-process-buffer proc buffer)
(set-process-coding-system proc 'binary 'binary)
(set-buffer-file-coding-system 'binary t)
(set-process-filter proc #'erc-dcc-get-filter)
(set-process-sentinel proc #'erc-dcc-get-sentinel)
(setq erc-dcc-entry-data (plist-put (plist-put entry :peer proc)
:start-time (erc-current-time))))))