changeset 26167:4cbe258db067

fix a bug in libpurple that prevented receiving file transfers to be marked completed (in case the protocol uses an xfer->ops.read function)
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 28 Jan 2009 07:34:18 +0000
parents bc31ebd391d3
children 1520b67d792f
files libpurple/ft.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ft.c	Wed Jan 28 07:01:37 2009 +0000
+++ b/libpurple/ft.c	Wed Jan 28 07:34:18 2009 +0000
@@ -857,8 +857,12 @@
 	else
 		s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size);
 
-	if (xfer->ops.read != NULL)
+	if (xfer->ops.read != NULL)	{
 		r = (xfer->ops.read)(buffer, xfer);
+		if ((purple_xfer_get_size(xfer) > 0) &&
+			((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)))
+			purple_xfer_set_completed(xfer, TRUE);
+	}
 	else {
 		*buffer = g_malloc0(s);