changeset 9226:7a00289f2ef1

[gaim-migrate @ 10022] Some fixes from shx. The progress indicator for file transfers was being reset to 0 after files have been sent, and files were being truncated to 0 bytes. Also, when the file was transfered, the status was being set to "cancel." These are fixed now. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 20:56:54 +0000
parents 554ef91db2dd
children 9171e528d7e5
files src/protocols/msn/slp.c src/protocols/msn/slplink.c
diffstat 2 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/slp.c	Sun Jun 06 20:45:53 2004 +0000
+++ b/src/protocols/msn/slp.c	Sun Jun 06 20:56:54 2004 +0000
@@ -131,8 +131,8 @@
 
 	xfer = slpcall->xfer;
 
-	xfer->bytes_sent = offset;
-	xfer->bytes_remaining = total_length - offset;
+	xfer->bytes_sent = (offset + len);
+	xfer->bytes_remaining = total_length - (offset + len);
 
 	gaim_xfer_update_progress(xfer);
 }
@@ -141,10 +141,13 @@
 msn_xfer_finish_cb(MsnSlpCall *slpcall,
 				   const char *body, long long size)
 {
-	if (size < 0)
-		gaim_xfer_cancel_remote(slpcall->xfer);
-	else
-		gaim_xfer_set_completed(slpcall->xfer, TRUE);
+	if (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_DONE)
+	{
+		if (size < 0)
+			gaim_xfer_cancel_remote(slpcall->xfer);
+		else
+			gaim_xfer_set_completed(slpcall->xfer, TRUE);
+	}
 }
 
 /**************************************************************************
--- a/src/protocols/msn/slplink.c	Sun Jun 06 20:45:53 2004 +0000
+++ b/src/protocols/msn/slplink.c	Sun Jun 06 20:56:54 2004 +0000
@@ -293,11 +293,14 @@
 
 	msn_slplink_send_msg(slplink, msg);
 
-	if ((slpmsg->slpcall != NULL) &&
-		(slpmsg->slpcall->progress_cb != NULL))
+	if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
 	{
-		slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, len,
-									 slpmsg->offset);
+		if ((slpmsg->slpcall != NULL) &&
+			(slpmsg->slpcall->progress_cb != NULL))
+		{
+			slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, len,
+										slpmsg->offset);
+		}
 	}
 
 	slpmsg->offset += len;
@@ -467,14 +470,18 @@
 
 			if (slpmsg->slpcall != NULL)
 			{
-				GaimXfer *xfer;
+				if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
+				{
+					GaimXfer *xfer;
 
-				xfer = slpmsg->slpcall->xfer;
+					xfer = slpmsg->slpcall->xfer;
 
-				if (xfer != NULL)
-				{
-					slpmsg->fp =
-						fopen(gaim_xfer_get_local_filename(slpmsg->slpcall->xfer), "wb");
+					if (xfer != NULL)
+					{
+						slpmsg->fp =
+							fopen(gaim_xfer_get_local_filename(slpmsg->slpcall->xfer),
+								  "wb");
+					}
 				}
 			}
 		}