soc.2008.yahoo: 1ee63387: Add + in place of spaces in p2p url, fix...
sulabh at soc.pidgin.im
sulabh at soc.pidgin.im
Sat Jul 12 15:50:53 EDT 2008
-----------------------------------------------------------------
Revision: 1ee633879223e4305cd9d2d45e46843a3320faef
Ancestor: dce5b56c567065396f0cce66c40b803c4005ab92
Author: sulabh at soc.pidgin.im
Date: 2008-07-09T18:19:37
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/1ee633879223e4305cd9d2d45e46843a3320faef
Modified files:
libpurple/protocols/yahoo/yahoo_filexfer.c
ChangeLog:
Add + in place of spaces in p2p url, fixes transfer of file with name containing spaces
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c 24413464c35c850f9b0e209c913565a8c26344ed
+++ libpurple/protocols/yahoo/yahoo_filexfer.c 22b0b37e35ef5561c9b8fcdfc34031e0b9d0cd59
@@ -1330,7 +1330,7 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpo
url_head = g_strdup_printf("HEAD %s", xd->xfer_url);
url_get = g_strdup_printf("GET %s", xd->xfer_url);
-
+
if( strncmp(url_head, (char *)buf, strlen(url_head)) == 0 )
xd->status_15 = P2P_HEAD_REQUESTED;
else if( strncmp(url_get, (char *)buf, strlen(url_get)) == 0 )
@@ -1405,6 +1405,8 @@ static void yahoo_p2p_ft_server_listen_c
gchar *filename;
const char *local_ip;
gchar *url_to_send = NULL;
+ char **split;
+ char *filename_without_spaces = NULL;
xfer = data;
if ( !( (xd = xfer->data) || (listenfd != -1) ) ) {
@@ -1422,7 +1424,10 @@ static void yahoo_p2p_ft_server_listen_c
local_ip = purple_network_get_my_ip(listenfd);
xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd);
- xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename, xfer->who);
+
+ split = g_strsplit(filename, " ", 0);
+ filename_without_spaces = g_strjoinv("+", split);
+ xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who);
url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url);
xd->info_val_249 = 1; /* 249=1: we are p2p server */
@@ -1437,6 +1442,8 @@ static void yahoo_p2p_ft_server_listen_c
g_free(filename);
g_free(url_to_send);
+ g_strfreev(split);
+ g_free(filename_without_spaces);
}
/* Add an Input Read event to the file descriptor */
More information about the Commits
mailing list