diff src/ft.c @ 8316:cf84056fed27

[gaim-migrate @ 9040] this still needs a lot of work, but for the special case of perfect conditions and no errors, you can now send files via jabber. enjoy! committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 22 Feb 2004 22:10:47 +0000
parents b5dbd1839716
children ffa642240fc1
line wrap: on
line diff
--- a/src/ft.c	Sun Feb 22 01:30:33 2004 +0000
+++ b/src/ft.c	Sun Feb 22 22:10:47 2004 +0000
@@ -463,6 +463,8 @@
 		if ((gaim_xfer_get_size(xfer) > 0) &&
 			((gaim_xfer_get_bytes_sent(xfer)+r) >= gaim_xfer_get_size(xfer)))
 			gaim_xfer_set_completed(xfer, TRUE);
+		else if(r <= 0)
+			r = -1;
 	}
 
 	return r;
@@ -496,12 +498,16 @@
 	GaimXferUiOps *ui_ops;
 	GaimXfer *xfer = (GaimXfer *)data;
 	char *buffer = NULL;
-	size_t r;
+	ssize_t r;
 
 	if (condition & GAIM_INPUT_READ) {
 		r = gaim_xfer_read(xfer, &buffer);
-		if (r > 0)
+		if (r > 0) {
 			fwrite(buffer, 1, r, xfer->dest_fp);
+		} else if(r < 0) {
+			gaim_xfer_cancel_remote(xfer);
+			return;
+		}
 	}
 	else {
 		size_t s = MIN(gaim_xfer_get_bytes_remaining(xfer), 4096);