changeset 27754:754a82f1371b

half baked fixes for file transfer.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 17 Dec 2007 08:20:42 +0000
parents 0d60830ab85f
children 9a60b9fab0ea
files libpurple/protocols/jabber/si.c libpurple/protocols/oscar/oft.c libpurple/protocols/yahoo/util.c libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 4 files changed, 34 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/si.c	Mon Dec 17 07:48:27 2007 +0000
+++ b/libpurple/protocols/jabber/si.c	Mon Dec 17 08:20:42 2007 +0000
@@ -897,17 +897,17 @@
 	JabberIq *iq;
 	xmlnode *si, *file, *feature, *x, *field, *option, *value;
 	char buf[32];
+    gchar *f1 = NULL, *f2 = NULL;
+    size_t dummy;
 
-//	xfer->filename = g_path_get_basename(xfer->local_filename);
-	{ /* yaz */
-		guchar *tmp;
-		size_t dummy;
-		tmp = botch_utf(xfer->filename, strlen(xfer->filename), &dummy);
-		if(tmp){
-			purple_xfer_set_filename(xfer, (char *)tmp);
-			g_free(tmp);
-		}
-	}
+    /* yaz */
+    f1 = g_filename_display_basename(xfer->local_filename);
+    f2 = botch_utf(f1, strlen(f1), &dummy);
+    if(f2){
+        purple_xfer_set_filename(xfer, (char *)f2);
+    }
+    g_free(f1); f1 = NULL;
+    g_free(f2); f2 = NULL;
 
 	iq = jabber_iq_new(jsx->js, JABBER_IQ_SET);
 	xmlnode_set_attrib(iq->node, "to", xfer->who);
--- a/libpurple/protocols/oscar/oft.c	Mon Dec 17 07:48:27 2007 +0000
+++ b/libpurple/protocols/oscar/oft.c	Mon Dec 17 08:20:42 2007 +0000
@@ -642,6 +642,8 @@
 {
 	PeerConnection *conn;
 	size_t size;
+    gchar *f1 = NULL, *f2 = NULL;
+    size_t dummy;
 
 	conn = xfer->data;
 	conn->flags |= PEER_CONNECTION_FLAG_APPROVED;
@@ -679,15 +681,16 @@
 	strncpy((gchar *)conn->xferdata.idstring, "Cool FileXfer", 31);
 	conn->xferdata.modtime = 0;
 	conn->xferdata.cretime = 0;
-	{ /* yaz */
-		guchar *tmp = NULL;
-		size_t dummy;
-		tmp = botch_utf(xfer->filename, strlen(xfer->filename), &dummy);
-		if(tmp){
-			purple_xfer_set_filename(xfer, (char *)tmp);
-			g_free(tmp);
-		}
-	}
+
+    /* yaz */
+    f1 = g_filename_display_basename(xfer->local_filename);
+    f2 = botch_utf(f1, strlen(f1), &dummy);
+    if(f2){
+        purple_xfer_set_filename(xfer, (char *)f2);
+    }
+    g_free(f1); f1 = NULL;
+    g_free(f2); f2 = NULL;
+
 	conn->xferdata.name_length = MAX(64, strlen(xfer->filename) + 1);
 	conn->xferdata.name = (guchar *)g_strndup(xfer->filename, conn->xferdata.name_length - 1);
 
--- a/libpurple/protocols/yahoo/util.c	Mon Dec 17 07:48:27 2007 +0000
+++ b/libpurple/protocols/yahoo/util.c	Mon Dec 17 08:20:42 2007 +0000
@@ -63,7 +63,8 @@
 	else
 		to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset",  "ISO-8859-1");
 
-	strtmp = sanitize_utf((char *)str, strlen((char *)str), &newlen);
+//	strtmp = sanitize_utf((char *)str, strlen((char *)str), &newlen);
+    strtmp = g_strdup(str);
 
 	ret = g_convert_with_fallback(strtmp, strlen(strtmp), to_codeset, "UTF-8", "?", NULL, NULL, NULL);
 
@@ -111,7 +112,8 @@
 
 	if (ret){
 		tmp = ret;
-		ret = botch_utf(ret, strlen(ret), &newlen);
+//		ret = botch_utf(tmp, strlen(tmp), &newlen);
+        ret = g_strdup(tmp);
 		g_free(tmp);
 		return ret;
 	}
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Mon Dec 17 07:48:27 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Mon Dec 17 08:20:42 2007 +0000
@@ -243,7 +243,7 @@
 	PurpleXfer *xfer;
 	struct yahoo_xfer_data *xd;
 	struct yahoo_packet *pkt;
-	gchar *size, *filename, *encoded_filename, *header;
+	gchar *size, *filename, *encoded_filename, *header, *tmp = NULL;
 	guchar *pkt_buf;
 	const char *host;
 	int port;
@@ -251,6 +251,7 @@
 	PurpleConnection *gc;
 	PurpleAccount *account;
 	struct yahoo_data *yd;
+	size_t dummy;
 
 	purple_debug(PURPLE_DEBUG_INFO, "yahoo",
 			   "AAA - in yahoo_sendfile_connected\n");
@@ -277,8 +278,12 @@
 		YAHOO_STATUS_AVAILABLE, yd->session_id);
 
 	size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer));
-	filename = g_path_get_basename(purple_xfer_get_local_filename(xfer));
-	encoded_filename = yahoo_string_encode(gc, filename, NULL);
+
+	/* yaz */
+	tmp = g_filename_display_basename(purple_xfer_get_local_filename(xfer));
+	filename = botch_utf(tmp, strlen(tmp), &dummy);
+	g_free(tmp);
+	encoded_filename = yahoo_string_encode(gc, filename, NULL); // this takes utf8 as input. --yaz
 
 	yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc),
 	  5, xfer->who, 14, "", 27, encoded_filename, 28, size);