| 92 const char *host; |
92 const char *host; |
| 93 int content_length, port; |
93 int content_length, port; |
| 94 GaimConnection *gc; |
94 GaimConnection *gc; |
| 95 GaimAccount *account; |
95 GaimAccount *account; |
| 96 struct yahoo_data *yd; |
96 struct yahoo_data *yd; |
| 97 char *filename; |
97 char *filename, *encoded_filename; |
| 98 |
98 |
| 99 gaim_debug(GAIM_DEBUG_INFO, "yahoo", |
99 gaim_debug(GAIM_DEBUG_INFO, "yahoo", |
| 100 "AAA - in yahoo_sendfile_connected\n"); |
100 "AAA - in yahoo_sendfile_connected\n"); |
| 101 if (!(xfer = data)) |
101 if (!(xfer = data)) |
| 102 return; |
102 return; |
| 122 |
122 |
| 123 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
123 pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
| 124 |
124 |
| 125 size = g_strdup_printf("%" G_GSIZE_FORMAT, gaim_xfer_get_size(xfer)); |
125 size = g_strdup_printf("%" G_GSIZE_FORMAT, gaim_xfer_get_size(xfer)); |
| 126 filename = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); |
126 filename = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); |
| |
127 encoded_filename = yahoo_string_encode(gc, filename, NULL); |
| 127 |
128 |
| 128 yahoo_packet_hash(pkt, "sssss", 0, gaim_connection_get_display_name(gc), |
129 yahoo_packet_hash(pkt, "sssss", 0, gaim_connection_get_display_name(gc), |
| 129 5, xfer->who, 14, "", 27, filename, 28, size); |
130 5, xfer->who, 14, "", 27, encoded_filename, 28, size); |
| 130 |
131 |
| 131 content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); |
132 content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); |
| 132 |
133 |
| 133 buf = g_strdup_printf("Y=%s; T=%s", yd->cookie_y, yd->cookie_t); |
134 buf = g_strdup_printf("Y=%s; T=%s", yd->cookie_y, yd->cookie_t); |
| 134 |
135 |
| 421 /* Build the file transfer handle. */ |
423 /* Build the file transfer handle. */ |
| 422 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, from); |
424 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, from); |
| 423 xfer->data = xfer_data; |
425 xfer->data = xfer_data; |
| 424 |
426 |
| 425 /* Set the info about the incoming file. */ |
427 /* Set the info about the incoming file. */ |
| 426 if (filename) |
428 if (filename) { |
| 427 gaim_xfer_set_filename(xfer, filename); |
429 char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
| 428 else { |
430 gaim_xfer_set_filename(xfer, utf8_filename); |
| |
431 g_free(utf8_filename); |
| |
432 } else { |
| 429 gchar *start, *end; |
433 gchar *start, *end; |
| 430 start = g_strrstr(xfer_data->path, "/"); |
434 start = g_strrstr(xfer_data->path, "/"); |
| 431 if (start) |
435 if (start) |
| 432 start++; |
436 start++; |
| 433 end = g_strrstr(xfer_data->path, "?"); |
437 end = g_strrstr(xfer_data->path, "?"); |
| 434 if (start && *start && end) { |
438 if (start && *start && end) { |
| |
439 char *utf8_filename; |
| 435 filename = g_strndup(start, end - start); |
440 filename = g_strndup(start, end - start); |
| 436 gaim_xfer_set_filename(xfer, filename); |
441 utf8_filename = yahoo_string_decode(gc, filename, TRUE); |
| 437 g_free(filename); |
442 g_free(filename); |
| |
443 gaim_xfer_set_filename(xfer, utf8_filename); |
| |
444 g_free(utf8_filename); |
| 438 filename = NULL; |
445 filename = NULL; |
| 439 } |
446 } |
| 440 } |
447 } |
| 441 |
448 |
| 442 gaim_xfer_set_size(xfer, filesize); |
449 gaim_xfer_set_size(xfer, filesize); |