summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-03-04 21:43:21 +0100
committerGitHub <noreply@github.com>2017-03-04 21:43:21 +0100
commit29f27cfb39a86094af746c1cd654d33436d29479 (patch)
treeceda3b35ac8830275c9d1f10d07e7dc8bfcb1ac2 /src/irc
parentdc99f8d7a5f90eebd4c52cef8d186bf20e2a9912 (diff)
parent027acffb4208d7e6ba8e229cbf6c3dae6f5dabaf (diff)
downloadirssi-29f27cfb39a86094af746c1cd654d33436d29479.zip
Merge pull request #658 from LemonBoy/dcc-autoaccept
Quote the filename when dcc requests are auto accepted.
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/dcc/dcc-autoget.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/irc/dcc/dcc-autoget.c b/src/irc/dcc/dcc-autoget.c
index de23a5d1..21417211 100644
--- a/src/irc/dcc/dcc-autoget.c
+++ b/src/irc/dcc/dcc-autoget.c
@@ -23,6 +23,7 @@
#include "masks.h"
#include "settings.h"
#include "servers.h"
+#include "misc.h"
#include "dcc-get.h"
@@ -30,7 +31,7 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
{
struct stat statbuf;
const char *masks;
- char *str, *file;
+ char *str, *file, *esc_arg;
int max_size;
if (!IS_DCC_GET(dcc)) return;
@@ -68,11 +69,14 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
/* ok. but do we want/need to resume? */
file = dcc_get_download_path(dcc->arg);
+ /* we have to escape the quotes as the whole file name gets quoted */
+ esc_arg = escape_string(dcc->arg, "\"");
str = g_strdup_printf(settings_get_bool("dcc_autoresume") &&
stat(file, &statbuf) == 0 ?
- "RESUME %s %s" : "GET %s %s",
- dcc->nick, dcc->arg);
+ "RESUME %s \"%s\"" : "GET %s \"%s\"",
+ dcc->nick, esc_arg);
signal_emit("command dcc", 2, str, dcc->server);
+ g_free(esc_arg);
g_free(file);
g_free(str);
}