diff src/protocols/yahoo/yahoo_filexfer.c @ 7805:5f0bb52c0609

[gaim-migrate @ 8452] File transfer changes from marv. This fixes various ft related bugs, including: * Sometimes clicking cancel on a send would crash. * We seemed to leak the GaimXfer most of the time. * Choosing to not overwrite the file would cancel the receive altogether. This should fix all these issues. It would be nice if someone (SimGuy?) could test this for me, especially on windows, to make sure i didn't break anything. Jabber ft is untested, althoughi didn't make any changes in the jabber source. So, it should still work, i just can't comfirm it. Yahoo and OSCAR do still work. Amoung other things, this patch impliments some reference counting on the GaimXfer, so the ui can keep it around a while if it wants, without leaking it because we're afraid to destroy it. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 08 Dec 2003 04:58:07 +0000
parents 45fd907e1d48
children ee32e030c9be
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo_filexfer.c	Mon Dec 08 03:51:33 2003 +0000
+++ b/src/protocols/yahoo/yahoo_filexfer.c	Mon Dec 08 04:58:07 2003 +0000
@@ -68,7 +68,7 @@
 		return;
 	if (source < 0) {
 		gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, _("Unable to connect."));
-		gaim_xfer_end(xfer);
+		gaim_xfer_cancel_remote(xfer);
 		return;
 	}
 
@@ -122,6 +122,7 @@
 	GaimConnection *gc;
 	GaimAccount *account;
 	struct yahoo_data *yd;
+	char *filename;
 
 	gaim_debug(GAIM_DEBUG_INFO, "yahoo",
 			   "AAA - in yahoo_sendfile_connected\n");
@@ -138,7 +139,7 @@
 
 	if (source < 0) {
 		gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, _("Unable to connect."));
-		gaim_xfer_end(xfer);
+		gaim_xfer_cancel_remote(xfer);
 		return;
 	}
 
@@ -153,7 +154,8 @@
 	yahoo_packet_hash(pkt, 0, gaim_connection_get_display_name(gc));
 	yahoo_packet_hash(pkt, 5, xfer->who);
 	yahoo_packet_hash(pkt, 14, "");
-	yahoo_packet_hash(pkt, 27, gaim_xfer_get_local_filename(xfer));
+	filename = g_path_get_basename(gaim_xfer_get_local_filename(xfer));
+	yahoo_packet_hash(pkt, 27, filename);
 	yahoo_packet_hash(pkt, 28, size);
 
 	content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt);
@@ -179,6 +181,7 @@
 	g_free(size);
 	g_free(post);
 	g_free(buf);
+	g_free(filename);
 }
 
 static void yahoo_xfer_init(GaimXfer *xfer)
@@ -517,5 +520,5 @@
 	gaim_xfer_set_write_fnc(xfer,       yahoo_xfer_write);
 
 	/* Now perform the request */
-	gaim_xfer_request_accepted(xfer, g_strdup(file));
+	gaim_xfer_request_accepted(xfer, file);
 }