Function: erc-dcc-send-file

erc-dcc-send-file is an interactive and byte-compiled function defined in erc-dcc.el.gz.

Signature

(erc-dcc-send-file NICK FILE &optional PPROC)

Documentation

Open socket for incoming connections and send a CTCP send request to the other client.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-send-file (nick file &optional pproc)
  "Open socket for incoming connections and send a CTCP send request to the
other client."
  (interactive "sNick: \nfFile: ")
  (when (null pproc) (if (processp erc-server-process)
                         (setq pproc erc-server-process)
                       (error "Can not find parent process")))
  (if (featurep 'make-network-process)
      (let* ((buffer (erc-dcc-find-file file))
             (size (buffer-size buffer))
             (start (with-current-buffer buffer
                      (point-min-marker)))
             (sproc (erc-dcc-server "dcc-send"
                                    'erc-dcc-send-filter
                                    'erc-dcc-send-sentinel))
             (contact (process-contact sproc)))
        (erc-dcc-list-add
         'SEND nick sproc pproc
         :file file :size size
         :sent start :confirmed (copy-marker start))
        (process-send-string
         pproc (format "PRIVMSG %s :\C-aDCC SEND %s %s %d %d\C-a\n"
                       nick (erc-dcc-file-to-name file)
                       (erc-ip-to-decimal (or erc-dcc-public-host
                                              (nth 0 contact)))
                       (nth 1 contact)
                       size)))
    (error "`make-network-process' not supported by your Emacs")))