Function: erc-dcc-send-block

erc-dcc-send-block is a byte-compiled function defined in erc-dcc.el.gz.

Signature

(erc-dcc-send-block PROC)

Documentation

Send one block of data.

PROC is the process-object of the DCC connection. Returns the number of bytes sent.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-send-block (proc)
  "Send one block of data.
PROC is the process-object of the DCC connection.  Returns the number of
bytes sent."
  (let* ((elt (erc-dcc-member :peer proc))
         (confirmed-marker (plist-get elt :confirmed))
         (sent-marker (plist-get elt :sent)))
    (with-current-buffer (process-buffer proc)
      (when erc-dcc-verbose
        (erc-display-message
         nil 'notice (erc-dcc-get-parent proc)
         (format "DCC: Confirmed %d, sent %d, sending block now"
                 (- confirmed-marker (point-min))
               (- sent-marker (point-min)))))
      (let* ((end (min (+ sent-marker erc-dcc-block-size)
                       (point-max)))
             (string (buffer-substring-no-properties sent-marker end)))
        (when (< sent-marker end)
          (set-marker sent-marker end)
          (process-send-string proc string))
        (length string)))))