mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Merge pull request #666 from irssi/revert-658-dcc-autoaccept
Revert "Quote the filename when dcc requests are auto accepted."
This commit is contained in:
commit
7f4fd60370
@ -724,20 +724,18 @@ int expand_escape(const char **data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Escape all the characters in `what' with a backslash */
|
/* Escape all '"', "'" and '\' chars with '\' */
|
||||||
char *escape_string(const char *str, const char *what)
|
char *escape_string(const char *str)
|
||||||
{
|
{
|
||||||
const char *p;
|
char *ret, *p;
|
||||||
char *ret;
|
|
||||||
|
|
||||||
ret = g_malloc(strlen(str) * 2 + 1);
|
p = ret = g_malloc(strlen(str)*2+1);
|
||||||
for (p = str; *p != '\0'; p++, ret++) {
|
while (*str != '\0') {
|
||||||
if (strchr(what, *p) != NULL) {
|
if (*str == '"' || *str == '\'' || *str == '\\')
|
||||||
*ret++ = '\\';
|
*p++ = '\\';
|
||||||
}
|
*p++ = *str++;
|
||||||
*ret = *p;
|
|
||||||
}
|
}
|
||||||
*ret = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,8 @@ char *stristr_full(const char *data, const char *key);
|
|||||||
char *ascii_strup(char *str);
|
char *ascii_strup(char *str);
|
||||||
char *ascii_strdown(char *str);
|
char *ascii_strdown(char *str);
|
||||||
|
|
||||||
/* Escape all the characters in `what' with a backslash */
|
/* Escape all '"', "'" and '\' chars with '\' */
|
||||||
char *escape_string(const char *str, const char *what);
|
char *escape_string(const char *str);
|
||||||
|
|
||||||
/* convert all low-ascii (<32) to ^<A..> combinations */
|
/* convert all low-ascii (<32) to ^<A..> combinations */
|
||||||
char *show_lowascii(const char *str);
|
char *show_lowascii(const char *str);
|
||||||
|
@ -1113,7 +1113,7 @@ static void event_text(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||||||
/* the nick is quoted in case it contains '-' character. also
|
/* the nick is quoted in case it contains '-' character. also
|
||||||
spaces should work too now :) The nick is also escaped in case
|
spaces should work too now :) The nick is also escaped in case
|
||||||
it contains '\' characters */
|
it contains '\' characters */
|
||||||
target = escape_string(window_item_get_target(item), "\"'\\");
|
target = escape_string(window_item_get_target(item));
|
||||||
str = g_strdup_printf(IS_CHANNEL(item) ? "-channel \"%s\" %s" :
|
str = g_strdup_printf(IS_CHANNEL(item) ? "-channel \"%s\" %s" :
|
||||||
IS_QUERY(item) ? "-nick \"%s\" %s" : "%s %s",
|
IS_QUERY(item) ? "-nick \"%s\" %s" : "%s %s",
|
||||||
target, line);
|
target, line);
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "masks.h"
|
#include "masks.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "servers.h"
|
#include "servers.h"
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#include "dcc-get.h"
|
#include "dcc-get.h"
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
|
|||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
const char *masks;
|
const char *masks;
|
||||||
char *str, *file, *esc_arg;
|
char *str, *file;
|
||||||
int max_size;
|
int max_size;
|
||||||
|
|
||||||
if (!IS_DCC_GET(dcc)) return;
|
if (!IS_DCC_GET(dcc)) return;
|
||||||
@ -69,14 +68,11 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
|
|||||||
|
|
||||||
/* ok. but do we want/need to resume? */
|
/* ok. but do we want/need to resume? */
|
||||||
file = dcc_get_download_path(dcc->arg);
|
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") &&
|
str = g_strdup_printf(settings_get_bool("dcc_autoresume") &&
|
||||||
stat(file, &statbuf) == 0 ?
|
stat(file, &statbuf) == 0 ?
|
||||||
"RESUME %s \"%s\"" : "GET %s \"%s\"",
|
"RESUME %s %s" : "GET %s %s",
|
||||||
dcc->nick, esc_arg);
|
dcc->nick, dcc->arg);
|
||||||
signal_emit("command dcc", 2, str, dcc->server);
|
signal_emit("command dcc", 2, str, dcc->server);
|
||||||
g_free(esc_arg);
|
|
||||||
g_free(file);
|
g_free(file);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user