Mercurial > pidgin
diff src/ft.c @ 4538:009e206f260c
[gaim-migrate @ 4817]
Jabber can receive files again.
I'm sure everyone was losing as much sleep over this as I was.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 06 Feb 2003 04:32:54 +0000 |
parents | f8fec48f0fde |
children | 05476ef20d58 |
line wrap: on
line diff
--- a/src/ft.c Wed Feb 05 23:54:11 2003 +0000 +++ b/src/ft.c Thu Feb 06 04:32:54 2003 +0000 @@ -4,7 +4,7 @@ * gaim * * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -63,7 +63,7 @@ if (xfer == NULL) return; - if (xfer->bytes_remaining > 0) { + if (!xfer->completed) { gaim_xfer_cancel(xfer); return; } @@ -282,6 +282,15 @@ } void +gaim_xfer_set_completed(struct gaim_xfer *xfer, gboolean completed) +{ + if(xfer == NULL) + return; + + xfer->completed = completed; +} + +void gaim_xfer_set_filename(struct gaim_xfer *xfer, const char *filename) { if (xfer == NULL) @@ -311,6 +320,9 @@ if (xfer == NULL) return; + if(xfer->size == 0) + xfer->bytes_remaining = size - xfer->bytes_sent; + xfer->size = size; } @@ -414,6 +426,9 @@ *buffer = g_malloc0(s); r = read(xfer->fd, *buffer, s); + + if(r == 0) + gaim_xfer_set_completed(xfer, TRUE); } return r; @@ -472,7 +487,8 @@ if (r < 0) return; - xfer->bytes_remaining -= r; + if(gaim_xfer_get_size(xfer) > 0) + xfer->bytes_remaining -= r; xfer->bytes_sent += r; if (xfer->ops.ack != NULL) @@ -483,7 +499,7 @@ if (ui_ops != NULL && ui_ops->update_progress != NULL) ui_ops->update_progress(xfer, gaim_xfer_get_progress(xfer)); - if (r == 0) + if (xfer->completed) gaim_xfer_end(xfer); } @@ -575,7 +591,7 @@ return; /* See if we are actually trying to cancel this. */ - if (gaim_xfer_get_bytes_remaining(xfer) > 0) { + if (!xfer->completed) { gaim_xfer_cancel(xfer); return; }