diff options
author | Joakim Verona <joakim@verona.se> | 2011-12-28 04:12:56 +0100 |
---|---|---|
committer | Joakim Verona <joakim@verona.se> | 2011-12-28 04:12:56 +0100 |
commit | bb29f044aa967831cd664c54eba0de0c701436ce (patch) | |
tree | 1398cc9780bbae0fdad071a3a3765a571c3f6d7b /lisp/erc/erc-dcc.el | |
parent | 3c935a7e996701244d166f684119f0ff97e25496 (diff) | |
parent | 5e605a2e528955721fc6f2bd7b9f174c15075fb1 (diff) | |
download | emacs-bb29f044aa967831cd664c54eba0de0c701436ce.tar.gz emacs-bb29f044aa967831cd664c54eba0de0c701436ce.tar.bz2 emacs-bb29f044aa967831cd664c54eba0de0c701436ce.zip |
upstream i think
Diffstat (limited to 'lisp/erc/erc-dcc.el')
-rw-r--r-- | lisp/erc/erc-dcc.el | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 19e1801e03c..fce22aadcc4 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -649,7 +649,16 @@ 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]*\\)") + (concat "^DCC SEND \\(" + ;; Following part matches either filename without spaces + ;; or filename enclosed in double quotes with any number + ;; of escaped double quotes inside. + "\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^ ]+\\)" + "\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")) + +(defsubst erc-dcc-unquote-filename (filename) + (erc-replace-regexp-in-string "\\\\\\\\" "\\" + (erc-replace-regexp-in-string "\\\\\"" "\"" filename t t) t t)) (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. @@ -664,10 +673,12 @@ 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 3 query) + (erc-dcc-unquote-filename (match-string 2 query)))) + (ip (erc-decimal-to-ip (match-string 6 query))) + (port (match-string 7 query)) + (size (match-string 8 query))) ;; FIXME: a warning really should also be sent ;; if the ip address != the host the dcc sender is on. (erc-display-message |