all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Fixes to allow erc-dcc-get-filter to work properly
@ 2019-02-03 17:47 Victor Orlikowski
  2019-02-08  7:59 ` Eli Zaretskii
  2019-02-10 19:14 ` [PATCH] v2: " Victor Orlikowski
  0 siblings, 2 replies; 11+ messages in thread
From: Victor Orlikowski @ 2019-02-03 17:47 UTC (permalink / raw)
  To: emacs-devel@gnu.org

When using erc-dcc-get-filter with erc-dcc-verbose set to t, message
errors prevent the DCC get from completing correctly.

The attached patch adds some additional error checking to
erc-dcc-get-filter, and uses erc-dcc-file-name in place of
buffer-file-name (which ends up being nil in this context, and
causing the message errors).

From 22bbaa226ad0550f566b4d2978e0aea4c72f82a1 Mon Sep 17 00:00:00 2001
From: "Victor J. Orlikowski" <vjo@duke.edu>
Date: Sun, 3 Feb 2019 12:36:26 -0500
Subject: [PATCH] Perform additional validation in erc-dcc-get-filter, and use
 erc-dcc-file-name rather than buffer-file-name (which is actually nil in this
 context).

---
 lisp/erc/erc-dcc.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 8a40b1454b..842a3b2b19 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -979,17 +979,20 @@ rather than every 1024 byte block, but nobody seems to care."
     (let ((inhibit-read-only t)
           received-bytes)
       (goto-char (point-max))
-      (insert (string-make-unibyte str))
+      (if str
+          (insert (string-make-unibyte str)))
 
       (when (> (point-max) erc-dcc-receive-cache)
         (erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
-      (setq received-bytes (+ (buffer-size) erc-dcc-byte-count))
+      (setq received-bytes (buffer-size))
+      (if erc-dcc-byte-count
+          (setq received-bytes (+ received-bytes erc-dcc-byte-count)))
 
       (and erc-dcc-verbose
            (erc-display-message
             nil 'notice erc-server-process
             'dcc-get-bytes-received
-            ?f (file-name-nondirectory buffer-file-name)
+            ?f (file-name-nondirectory erc-dcc-file-name)
             ?b (number-to-string received-bytes)))
       (cond
        ((and (> (plist-get erc-dcc-entry-data :size) 0)
@@ -997,7 +1000,7 @@ rather than every 1024 byte block, but nobody seems to care."
         (erc-display-message
          nil '(notice error) 'active
          'dcc-get-file-too-long
-         ?f (file-name-nondirectory buffer-file-name))
+         ?f (file-name-nondirectory erc-dcc-file-name))
         (delete-process proc))
        (t
         (process-send-string
-- 
2.20.0

Best,
Victor
-- 
Victor J. Orlikowski <> vjo@(ee.|cs.)?duke.edu



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-02-17 19:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-03 17:47 [PATCH] Fixes to allow erc-dcc-get-filter to work properly Victor Orlikowski
2019-02-08  7:59 ` Eli Zaretskii
2019-02-08 22:00   ` Victor Orlikowski
2019-02-09  9:49     ` Eli Zaretskii
2019-02-10 16:07       ` Victor Orlikowski
2019-02-10 16:41         ` Eli Zaretskii
2019-02-10 19:02           ` Victor Orlikowski
2019-02-10 19:14 ` [PATCH] v2: " Victor Orlikowski
2019-02-15  8:18   ` Eli Zaretskii
2019-02-17 18:57     ` Victor Orlikowski
2019-02-17 19:32       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.