[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted fil
From: |
Mike Kazantsev |
Subject: |
[Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them |
Date: |
Sat, 29 Oct 2011 12:04:02 +0600 |
Good day,
This patch allows receiving DCC SEND requests like these (X'es in IP
are digits):
DCC SEND "Jim C. Hines - Jig the Goblin - 2 - Goblin Hero (RB v1.0).epub"
34732XXXXX 3746 322641
Filename here is enclosed in double quotes, which seem to be a common
IRC client (and dcc bot) convention for names with whitespaces and is
widely used in file-sharing channels.
Filenames without whitespace in them are not stripped of double quotes,
consistent with previous versions.
Change is basically matching ([^ ]+)|"(.*+?)" for filename instead of
just ([^ ]+).
Only one possible issue I can see with it is if filename *starts* with
double quote character and this character is used in some other field X,
*and* the overall field number in "number of field X" + 3 or greater.
I've never encountered such usage, and believe it's much more useful to
support the most common DCC SEND usage than these exotic cases if
indeed they exist at all.
Otherwise, I guess some option can be added to support such
quoted-filenames, but again, I don't think it's worth the complexity
and should be default behavior anyway.
Thanks!
From 3198d78525afadfbca7b33fd6168c1aba9bad205 Mon Sep 17 00:00:00 2001
From: Mike Kazantsev <address@hidden>
Date: Sat, 29 Oct 2011 11:36:49 +0600
Subject: [PATCH] erc-dcc: allow SEND commands containing quoted filenames
with spaces in them
* erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Updated regexp to match
quoted filenames with spaces inside.
(erc-dcc-handle-ctcp-send): Updated regexp match group numbers.
---
erc-dcc.el | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/erc-dcc.el b/erc-dcc.el
index 9e53edc..95b3d17 100644
--- a/erc-dcc.el
+++ b/erc-dcc.el
@@ -646,7 +646,7 @@ that subcommand."
?q query ?n nick ?u login ?h host))))
(defconst erc-dcc-ctcp-query-send-regexp
- "^DCC SEND \\([^ ]+\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")
+ "^DCC SEND \\(\\([^ ]+\\)\\|\"\\(.*+?\\)\"\\) \\([0-9]+\\) \\([0-9]+\\)
*\\([0-9]*\\)")
(defun erc-dcc-handle-ctcp-send (proc query nick login host to)
"This is called if a CTCP DCC SEND subcommand is sent to the client.
@@ -661,10 +661,11 @@ It extracts the information about the dcc request and
adds it to
'dcc-request-bogus
?r "SEND" ?n nick ?u login ?h host))
((string-match erc-dcc-ctcp-query-send-regexp query)
- (let ((filename (match-string 1 query))
- (ip (erc-decimal-to-ip (match-string 2 query)))
- (port (match-string 3 query))
- (size (match-string 4 query)))
+ (let ((filename
+ (or (match-string 2 query) (match-string 3 query)))
+ (ip (erc-decimal-to-ip (match-string 4 query)))
+ (port (match-string 5 query))
+ (size (match-string 6 query)))
;; FIXME: a warning really should also be sent
;; if the ip address != the host the dcc sender is on.
(erc-display-message
--
1.7.7
--
Mike Kazantsev // fraggod.net
signature.asc
Description: PGP signature
- [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them,
Mike Kazantsev <=
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Michael Olson, 2011/10/29
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Mike Kazantsev, 2011/10/30
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Mike Kazantsev, 2011/10/30
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Michael Olson, 2011/10/30
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Michael Olson, 2011/10/30
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Mike Kazantsev, 2011/10/30
- Re: [Erc-discuss] [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them, Michael Olson, 2011/10/30