From 075d6bb41089a7ea4bb5353dd70448ed5653261c Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 24 Jul 2022 05:14:24 -0700 Subject: [PATCH] Ensure erc-dcc-chat-setup runs in the right buffer * lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Ensure initialization runs in the intended buffer regardless of the value of `erc-join-buffer'. (erc-dcc--send-final-turbo-ack, erc-dcc-get-filter): Rename internal variable formerly known as `erc-dcc--X-send-final-turbo-ack'. --- lisp/erc/erc-dcc.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index d0e1848e0eb..5862fba3b81 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -987,7 +987,7 @@ The contents of the BUFFER will then be erased." ;; If people really need this, we can convert it into a proper option. -(defvar erc-dcc--X-send-final-turbo-ack nil +(defvar erc-dcc--send-final-turbo-ack nil "Workaround for maverick turbo senders that only require a final ACK. The only known culprit is WeeChat, with its xfer.network.fast_send option, which is on by default. Leaving this set to nil and calling @@ -1032,7 +1032,7 @@ rather than every 1024 byte block, but nobody seems to care." ;; 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--X-send-final-turbo-ack + (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) @@ -1182,18 +1182,18 @@ other client." (proc (plist-get entry :peer)) (parent-proc (plist-get entry :parent))) (erc-setup-buffer buffer) - ;; buffer is now the current buffer. - (erc-dcc-chat-mode) - (setq erc-server-process parent-proc) - (setq erc-dcc-from nick) - (setq erc-dcc-entry-data entry) - (setq erc-dcc-unprocessed-output "") - (setq erc-insert-marker (point-max-marker)) - (setq erc-input-marker (make-marker)) - (erc-display-prompt buffer (point-max)) - (set-process-buffer proc buffer) - (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t) - (run-hook-with-args 'erc-dcc-chat-connect-hook proc) + (with-current-buffer buffer + (erc-dcc-chat-mode) + (setq erc-server-process parent-proc + erc-dcc-from nick + erc-dcc-entry-data entry + erc-dcc-unprocessed-output "" + erc-insert-marker (point-max-marker) + erc-input-marker (make-marker)) + (erc-display-prompt buffer (point-max)) + (set-process-buffer proc buffer) + (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t) + (run-hook-with-args 'erc-dcc-chat-connect-hook proc)) buffer)) (defun erc-dcc-chat-accept (entry parent-proc) -- 2.39.2