changeset 9788:1e9ecca6c97e

[gaim-migrate @ 10656] "ixes sending declines when we would decline a request to an MSN file xfer. Fixes accidentally having 2 xfers of the same file in the transfer dialog when sending through MSN and SILC. Fixes crash when cancelling MSN file transfers. Should fix crash when removing old MSN transfers from the xfer window in MSN. Fixes MSN crash when the remote side sends a decline after we've canceled locally." --Dave West committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 20 Aug 2004 03:44:46 +0000
parents 904b757835ca
children 51a6a98d276b
files src/ft.c src/protocols/msn/slp.c src/protocols/msn/slplink.c src/protocols/silc/ft.c
diffstat 4 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/ft.c	Fri Aug 20 03:40:33 2004 +0000
+++ b/src/ft.c	Fri Aug 20 03:44:46 2004 +0000
@@ -77,10 +77,14 @@
 	if (ui_ops != NULL && ui_ops->destroy != NULL)
 		ui_ops->destroy(xfer);
 
-	g_free(xfer->who);
-	g_free(xfer->filename);
+	if( xfer->who != NULL )
+		g_free(xfer->who);
 
-	if (xfer->remote_ip != NULL) g_free(xfer->remote_ip);
+	if( xfer->filename != NULL )
+		g_free(xfer->filename);
+
+	if (xfer->remote_ip != NULL) 
+		g_free(xfer->remote_ip);
 
 	if (xfer->local_filename != NULL)
 		g_free(xfer->local_filename);
@@ -107,6 +111,15 @@
 		gaim_xfer_destroy(xfer);
 }
 
+static void
+gaim_xfer_set_status(GaimXfer *xfer, GaimXferStatusType status)
+{
+	g_return_if_fail(xfer != NULL);
+
+	xfer->status = status;
+}
+
+
 static void gaim_xfer_show_file_error(const char *filename)
 {
 	char *msg = NULL;
@@ -216,6 +229,7 @@
 {
 	GaimXfer *xfer = (GaimXfer *)user_data;
 
+  	gaim_xfer_set_status(xfer, GAIM_XFER_STATUS_CANCEL_LOCAL);
 	gaim_xfer_request_denied(xfer);
 }
 
@@ -233,6 +247,7 @@
 static int
 cancel_recv_cb(GaimXfer *xfer)
 {
+  	gaim_xfer_set_status(xfer, GAIM_XFER_STATUS_CANCEL_LOCAL);
 	gaim_xfer_request_denied(xfer);
 	gaim_xfer_unref(xfer);
 
@@ -500,14 +515,6 @@
 	return xfer->remote_port;
 }
 
-static void
-gaim_xfer_set_status(GaimXfer *xfer, GaimXferStatusType status)
-{
-	g_return_if_fail(xfer != NULL);
-
-	xfer->status = status;
-}
-
 void
 gaim_xfer_set_completed(GaimXfer *xfer, gboolean completed)
 {
@@ -925,7 +932,7 @@
 	gaim_request_close_with_handle(xfer);
 
 	msg = g_strdup_printf(_("%s canceled the transfer of %s"),
-	xfer->who, gaim_xfer_get_filename(xfer));
+					xfer->who, gaim_xfer_get_filename(xfer));
 	gaim_xfer_error(gaim_xfer_get_type(xfer), xfer->who, msg);
 	g_free(msg);
 
--- a/src/protocols/msn/slp.c	Fri Aug 20 03:40:33 2004 +0000
+++ b/src/protocols/msn/slp.c	Fri Aug 20 03:44:46 2004 +0000
@@ -92,7 +92,6 @@
 			content);
 
 	g_free(content);
-	gaim_xfer_add(xfer);
 	msn_slplink_unleash(slpcall->slplink);
 }
 
@@ -102,6 +101,9 @@
 	MsnSlpCall *slpcall;
 	char *content;
 
+	g_return_if_fail(xfer != NULL);
+	g_return_if_fail(xfer->data != NULL);
+
 	slpcall = xfer->data;
 
 	if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL)
--- a/src/protocols/msn/slplink.c	Fri Aug 20 03:40:33 2004 +0000
+++ b/src/protocols/msn/slplink.c	Fri Aug 20 03:44:46 2004 +0000
@@ -405,7 +405,6 @@
 	slpmsg->slpcall = slpcall;
 	msn_slpmsg_open_file(slpmsg, gaim_xfer_get_local_filename(slpcall->xfer));
 
-	gaim_xfer_add(slpcall->xfer);
 	msn_slplink_send_slpmsg(slpcall->slplink, slpmsg);
 }
 
--- a/src/protocols/silc/ft.c	Fri Aug 20 03:40:33 2004 +0000
+++ b/src/protocols/silc/ft.c	Fri Aug 20 03:44:46 2004 +0000
@@ -192,7 +192,6 @@
 		return;
 
 	/* Start the file transfer */
-	gaim_xfer_add(xfer->xfer);
 	status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn,
 					  silcgaim_ftp_monitor, xfer,
 					  NULL, xfer->session_id,
@@ -315,7 +314,6 @@
 		local_ip = silc_net_localip();
 
 	/* Send the file */
-	gaim_xfer_add(xfer->xfer);
 	silc_client_file_send(xfer->sg->client, xfer->sg->conn,
 			      silcgaim_ftp_monitor, xfer,
 			      local_ip, 0, !local, xfer->client_entry,