changeset 31113:a4c45a92938d

propagate from branch 'im.pidgin.pidgin' (head 780ee14f6ced21de7257b3149c186223ab446d57) to branch 'im.pidgin.cpw.qulogic.msnp16' (head 040f73ee06fdd19f6321c3dbd2ab760a9be3feef)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 14 Dec 2009 07:11:03 +0000
parents 88a3135c5a23 (current diff) 139aa186e8cc (diff)
children 43cf75e21702
files
diffstat 3 files changed, 43 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 14 03:26:44 2009 +0000
+++ b/ChangeLog	Mon Dec 14 07:11:03 2009 +0000
@@ -8,6 +8,12 @@
 	* Messages from some mobile clients are no longer displayed as
 	  Chinese characters (broken in 2.6.4)
 
+	MSN:
+	* File transfer requests will no longer cause a crash if you delete the file
+	  before the other side accepts.
+	* Recieved files will no longer hold an extra lock after completion, meaning
+	  they can be moved or deleted without complaints from your OS.
+
 	XMPP:
 	* Added support for the SCRAM-SHA-1 SASL mechanism.  This is only
 	  available when built without Cyrus SASL support.
--- a/libpurple/protocols/msn/slp.c	Mon Dec 14 03:26:44 2009 +0000
+++ b/libpurple/protocols/msn/slp.c	Mon Dec 14 07:11:03 2009 +0000
@@ -96,8 +96,6 @@
 
 	g_free(content);
 	msn_slplink_send_queued_slpmsgs(slpcall->slplink);
-
-	purple_xfer_start(xfer, -1, NULL, 0);
 }
 
 void
@@ -128,7 +126,10 @@
 			g_free(content);
 			msn_slplink_send_queued_slpmsgs(slpcall->slplink);
 
-			msn_slpcall_destroy(slpcall);
+			if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
+				slpcall->wasted = TRUE;
+			else
+				msn_slpcall_destroy(slpcall);
 		}
 	}
 }
--- a/libpurple/protocols/msn/slplink.c	Mon Dec 14 03:26:44 2009 +0000
+++ b/libpurple/protocols/msn/slplink.c	Mon Dec 14 07:11:03 2009 +0000
@@ -454,20 +454,22 @@
 send_file_cb(MsnSlpCall *slpcall)
 {
 	MsnSlpMessage *slpmsg;
-	struct stat st;
 	PurpleXfer *xfer;
 
+	xfer = (PurpleXfer *)slpcall->xfer;
+	purple_xfer_ref(xfer);
+	purple_xfer_start(xfer, -1, NULL, 0);
+	if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_STARTED) {
+		purple_xfer_unref(xfer);
+		return;
+	}
+	purple_xfer_unref(xfer);
+
 	slpmsg = msn_slpmsg_new(slpcall->slplink);
 	slpmsg->slpcall = slpcall;
 	slpmsg->flags = 0x1000030;
 	slpmsg->info = "SLP FILE";
-
-	xfer = (PurpleXfer *)slpcall->xfer;
-	purple_xfer_start(slpcall->xfer, -1, NULL, 0);
-	if (g_stat(purple_xfer_get_local_filename(xfer), &st) == 0)
-		slpmsg->size = st.st_size;
-	else if (purple_xfer_get_size(xfer))
-		slpmsg->size = purple_xfer_get_size(xfer);
+	slpmsg->size = purple_xfer_get_size(xfer);
 
 	msn_slplink_send_slpmsg(slpcall->slplink, slpmsg);
 }
@@ -620,29 +622,37 @@
 
 		slpcall = msn_slp_process_msg(slplink, slpmsg);
 
-		if (slpmsg->flags == 0x100)
-		{
-			MsnDirectConn *directconn;
+		if (slpcall == NULL) {
+			msn_slpmsg_destroy(slpmsg);
+			return;
+		}
 
-			directconn = slplink->directconn;
+		if (!slpcall->wasted) {
+			if (slpmsg->flags == 0x100)
+			{
+				MsnDirectConn *directconn;
+
+				directconn = slplink->directconn;
 #if 0
-			if (!directconn->acked)
-				msn_directconn_send_handshake(directconn);
+				if (!directconn->acked)
+					msn_directconn_send_handshake(directconn);
 #endif
-		}
-		else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 ||  
-		         slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 ||  
-		         slpmsg->flags == 0x1000030)
-		{
-			/* Release all the messages and send the ACK */
+			}
+			else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 ||  
+			         slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 ||  
+			         slpmsg->flags == 0x1000030)
+			{
+				/* Release all the messages and send the ACK */
 
-			msn_slplink_send_ack(slplink, msg);
-			msn_slplink_send_queued_slpmsgs(slplink);
+				msn_slplink_send_ack(slplink, msg);
+				msn_slplink_send_queued_slpmsgs(slplink);
+			}
+
 		}
 
 		msn_slpmsg_destroy(slpmsg);
 
-		if (slpcall != NULL && slpcall->wasted)
+		if (slpcall->wasted)
 			msn_slpcall_destroy(slpcall);
 	}
 }