Mercurial > pidgin.yaz
changeset 10976:be22eb8fa671
[gaim-migrate @ 12802]
Fix encoding of filename
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 06 Jun 2005 22:38:11 +0000 |
parents | e5f99cbcda9c |
children | 2ce8ec01a064 |
files | src/protocols/yahoo/yahoo_filexfer.c |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo_filexfer.c Mon Jun 06 20:40:37 2005 +0000 +++ b/src/protocols/yahoo/yahoo_filexfer.c Mon Jun 06 22:38:11 2005 +0000 @@ -94,7 +94,7 @@ GaimConnection *gc; GaimAccount *account; struct yahoo_data *yd; - char *filename; + char *filename, *encoded_filename; gaim_debug(GAIM_DEBUG_INFO, "yahoo", "AAA - in yahoo_sendfile_connected\n"); @@ -124,9 +124,10 @@ size = g_strdup_printf("%" G_GSIZE_FORMAT, gaim_xfer_get_size(xfer)); filename = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); + encoded_filename = yahoo_string_encode(gc, filename, NULL); yahoo_packet_hash(pkt, "sssss", 0, gaim_connection_get_display_name(gc), - 5, xfer->who, 14, "", 27, filename, 28, size); + 5, xfer->who, 14, "", 27, encoded_filename, 28, size); content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); @@ -150,6 +151,7 @@ g_free(size); g_free(post); g_free(buf); + g_free(encoded_filename); g_free(filename); } @@ -423,18 +425,23 @@ xfer->data = xfer_data; /* Set the info about the incoming file. */ - if (filename) - gaim_xfer_set_filename(xfer, filename); - else { + if (filename) { + char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); + gaim_xfer_set_filename(xfer, utf8_filename); + g_free(utf8_filename); + } else { gchar *start, *end; start = g_strrstr(xfer_data->path, "/"); if (start) start++; end = g_strrstr(xfer_data->path, "?"); if (start && *start && end) { + char *utf8_filename; filename = g_strndup(start, end - start); - gaim_xfer_set_filename(xfer, filename); + utf8_filename = yahoo_string_decode(gc, filename, TRUE); g_free(filename); + gaim_xfer_set_filename(xfer, utf8_filename); + g_free(utf8_filename); filename = NULL; } }