Function: erc-dcc-do-GET-command

erc-dcc-do-GET-command is a byte-compiled function defined in erc-dcc.el.gz.

Signature

(erc-dcc-do-GET-command PROC NICK &rest FILE)

Documentation

Do a DCC GET command. NICK is the person who is sending the file.

FILE is the filename. If FILE is split into multiple arguments, re-join the arguments, separated by a space. PROC is the server process.

WARNING: the /DCC GET command is bugged in ERC 5.5 (Emacs 29). File names containing the string " -" are not honored. If you need a fix immediately, see Info node (erc) Upgrading.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
(defun erc-dcc-do-GET-command (proc nick &rest file)
  "Do a DCC GET command.  NICK is the person who is sending the file.
FILE is the filename.  If FILE is split into multiple arguments,
re-join the arguments, separated by a space.
PROC is the server process.

WARNING: the /DCC GET command is bugged in ERC 5.5 (Emacs 29).
File names containing the string \" -\" are not honored.  If you
need a fix immediately, see Info node `(erc) Upgrading'."
  (let* ((args (seq-group-by (lambda (s) (eq ?- (aref s 0))) (cons nick file)))
         (flags (prog1 (cdr (assq t args))
                  (setq args (cdr (assq nil args))
                        nick (pop args)
                        file (and args (mapconcat #'identity args " ")))))
         (elt (erc-dcc-member :nick nick :type 'GET :file file))
         (filename (or file (plist-get elt :file) "unknown")))
    (if elt
        (let* ((file (read-file-name
                      (format-prompt "Local filename"
                                     (file-name-nondirectory filename))
                      (or erc-dcc-get-default-directory
                          default-directory)
                      (expand-file-name (file-name-nondirectory filename)
                                        (or erc-dcc-get-default-directory
                                            default-directory)))))
          (cond ((file-exists-p file)
                 (if (yes-or-no-p (format "File %s exists.  Overwrite? "
                                          file))
                     (erc-dcc-get-file elt file proc)
                   (erc-display-message
                    nil '(notice error) proc
                    'dcc-get-cmd-aborted
                    ?n nick ?f filename)))
                (t
                 (erc-dcc-get-file elt file proc)))
          (when (member "-s" flags)
            (setq erc-dcc-list (cons (plist-put elt :secure t)
                                     (delq elt erc-dcc-list))))
          (when (member "-t" flags)
            (setq erc-dcc-list (cons (plist-put elt :turbo t)
                                     (delq elt erc-dcc-list)))))
      (erc-display-message
       nil '(notice error) 'active
       'dcc-get-notfound ?n nick ?f filename))))