diff libgaim/ft.c @ 15261:5176a9f30ba3

[gaim-migrate @ 18050] AIM/ICQ file transfer pausing an resuming. This should work, but could use a little more testing. It's a patch from Graham Booker with modifcations by me. Blame me if I broke file transfer for anything. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 23 Dec 2006 19:32:10 +0000
parents ec96d6d2fa6d
children
line wrap: on
line diff
--- a/libgaim/ft.c	Sat Dec 23 05:42:41 2006 +0000
+++ b/libgaim/ft.c	Sat Dec 23 19:32:10 2006 +0000
@@ -698,10 +698,17 @@
 {
 	g_return_if_fail(xfer != NULL);
 
-	if (xfer->size == 0)
-		xfer->bytes_remaining = size - xfer->bytes_sent;
+	xfer->size = size;
+	xfer->bytes_remaining = xfer->size - gaim_xfer_get_bytes_sent(xfer);
+}
 
-	xfer->size = size;
+void
+gaim_xfer_set_bytes_sent(GaimXfer *xfer, size_t bytes_sent)
+{
+	g_return_if_fail(xfer != NULL);
+
+	xfer->bytes_sent = bytes_sent;
+	xfer->bytes_remaining = gaim_xfer_get_size(xfer) - bytes_sent;
 }
 
 GaimXferUiOps *
@@ -948,6 +955,8 @@
 		return;
 	}
 
+	fseek(xfer->dest_fp, xfer->bytes_sent, SEEK_SET);
+
 	xfer->watcher = gaim_input_add(xfer->fd, cond, transfer_cb, xfer);
 
 	xfer->start_time = time(NULL);
@@ -978,9 +987,6 @@
 
 	type = gaim_xfer_get_type(xfer);
 
-	xfer->bytes_remaining = gaim_xfer_get_size(xfer);
-	xfer->bytes_sent      = 0;
-
 	gaim_xfer_set_status(xfer, GAIM_XFER_STATUS_STARTED);
 
 	if (type == GAIM_XFER_RECEIVE) {