[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] v2: Fixes to allow erc-dcc-get-filter to work properly
From: |
Victor Orlikowski |
Subject: |
[PATCH] v2: Fixes to allow erc-dcc-get-filter to work properly |
Date: |
Sun, 10 Feb 2019 19:14:26 +0000 |
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 ethe function buffer-name in place of
the variable buffer-file-name (which appears to be nil in this
context, which thereby causes the message errors).
>From cd390337b8e819248568b900e6115dde8a19fde9 Mon Sep 17 00:00:00 2001
From: "Victor J. Orlikowski" <address@hidden>
Date: Sun, 10 Feb 2019 11:13:57 -0500
Subject: [PATCH] Perform additional validation in erc-dcc-get-filter, and use
the function buffer-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..2849e25bf7 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 (buffer-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 (buffer-name)))
(delete-process proc))
(t
(process-send-string
--
2.20.0
Thanks,
Victor
--
Victor J. Orlikowski <> vjo@(ee.|cs.)?duke.edu
[PATCH] v2: Fixes to allow erc-dcc-get-filter to work properly,
Victor Orlikowski <=