summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/plugins/irc/irc-ctcp.c49
2 files changed, 47 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d5e3ec929..420fcdd8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.3-dev, 2010-07-17
+v0.3.3-dev, 2010-07-18
Version 0.3.3 (under dev!)
@@ -52,6 +52,7 @@ Version 0.3.3 (under dev!)
(nick unavailable)
* irc: set buffer local variable "away" when opening new channel (bug #29618)
* fifo: fix bug with fifo pipe when setting fifo option to "on"
+* xfer: fix bug with double quotes in DCC filenames (bug #30471)
Version 0.3.2 (2010-04-18)
--------------------------
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index 3b8a5eae9..26f264bb4 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -372,6 +372,25 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
}
/*
+ * irc_ctcp_dcc_filename_without_quotes: return filename for DCC, without
+ * double quotes
+ */
+
+char *
+irc_ctcp_dcc_filename_without_quotes (const char *filename)
+{
+ int length;
+
+ length = strlen (filename);
+ if (length > 0)
+ {
+ if ((filename[0] == '\"') && (filename[length - 1] == '\"'))
+ return weechat_strndup (filename + 1, length - 2);
+ }
+ return strdup (filename);
+}
+
+/*
* irc_ctcp_recv_dcc: parse CTCP DCC
*/
@@ -379,7 +398,8 @@ void
irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
const char *arguments, char *message)
{
- char *dcc_args, *pos, *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume;
+ char *dcc_args, *pos, *pos_file, *pos_addr, *pos_port, *pos_size;
+ char *pos_start_resume, *filename;
struct t_infolist *infolist;
struct t_infolist_item *item;
char plugin_id[128], charset_modifier[256];
@@ -473,6 +493,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
pos[1] = '\0';
+ /* remove double quotes around filename */
+ filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
+
/* add DCC file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -488,7 +511,8 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
weechat_infolist_new_var_string (item, "protocol", "dcc");
weechat_infolist_new_var_string (item, "remote_nick", nick);
weechat_infolist_new_var_string (item, "local_nick", server->nick);
- weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_string (item, "filename",
+ (filename) ? filename : pos_file);
weechat_infolist_new_var_string (item, "size", pos_size);
weechat_infolist_new_var_string (item, "proxy",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY));
@@ -505,6 +529,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
WEECHAT_HOOK_SIGNAL_STRING,
message);
+ if (filename)
+ free (filename);
+
free (dcc_args);
}
else if (strncmp (arguments, "RESUME ", 7) == 0)
@@ -571,6 +598,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
pos[1] = '\0';
+ /* remove double quotes around filename */
+ filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
+
/* accept resume via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -583,7 +613,8 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"%lx", (long unsigned int)server);
weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
weechat_infolist_new_var_string (item, "type", "file_recv");
- weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_string (item, "filename",
+ (filename) ? filename : pos_file);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
weechat_hook_signal_send ("xfer_accept_resume",
@@ -597,6 +628,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
WEECHAT_HOOK_SIGNAL_STRING,
message);
+ if (filename)
+ free (filename);
+
free (dcc_args);
}
else if (strncmp (arguments, "ACCEPT ", 7) == 0)
@@ -663,6 +697,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
pos[1] = '\0';
+ /* remove double quotes around filename */
+ filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
+
/* resume file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -675,7 +712,8 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"%lx", (long unsigned int)server);
weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
weechat_infolist_new_var_string (item, "type", "file_recv");
- weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_string (item, "filename",
+ (filename) ? filename : pos_file);
weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
weechat_hook_signal_send ("xfer_start_resume",
@@ -689,6 +727,9 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
WEECHAT_HOOK_SIGNAL_STRING,
message);
+ if (filename)
+ free (filename);
+
free (dcc_args);
}
else if (strncmp (arguments, "CHAT ", 5) == 0)